Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CallJsExample7 - catch-throw removal #351

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Conversation

hakenr
Copy link
Contributor

@hakenr hakenr commented Sep 29, 2024

This catch statement just rethrows the exception and doesn't add any value to the sample.

(Maybe I would also update the other try-catch in the Dispose() method. The usual convention is to add a // NOOP comment in an empty catch statement to explicitly indicate the intent to ignore the exception.)

If you approve this PR, I will create a PR to aspnetdoc repo to pull the updated sample there.

cc @guardrex

@guardrex
Copy link
Collaborator

Thanks @hakenr ... One of the product unit engineers will need to look at this. They sent me this example for publication, and I assume they set it up this way with some kind of intent. They obviously didn't tell me to explain to readers why they just rethrow there, or I would've stated something in the article about it.

They're all busy at the moment finishing up for RC2. I'll contact Artak offline and ask him to add this to his list of things to address.

@guardrex
Copy link
Collaborator

I found the issue ... it was Javier ...

dotnet/AspNetCore.Docs#15517

Since he definitely doesn't do random things 😆, we definitely want him to take a look.

Artak will let him know ... or he'll let me know that it's ok to contact him. My understanding is that they're very busy right now, so it's best to hold off on anything that isn't a bug right now.

@hakenr
Copy link
Contributor Author

hakenr commented Sep 29, 2024

There are a few rare cases where such a rethrowing construct might make sense, but in that case, it's worth adding a comment with an explanation.
don't see the need for a try-catch-rethrow in this sample, but I'm curious to see if they provide any explanation.

Copy link
Collaborator

@guardrex guardrex left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The presence of the spaces is intentional.

3.1/BlazorSample_WebAssembly/Pages/CallJsExample7.razor.cs Outdated Show resolved Hide resolved
3.1/BlazorSample_WebAssembly/Pages/CallJsExample7.razor.cs Outdated Show resolved Hide resolved
3.1/BlazorSample_WebAssembly/Pages/CallJsExample7.razor.cs Outdated Show resolved Hide resolved
5.0/BlazorSample_Server/Pages/CallJsExample7.razor.cs Outdated Show resolved Hide resolved
5.0/BlazorSample_Server/Pages/CallJsExample7.razor.cs Outdated Show resolved Hide resolved
7.0/BlazorSample_WebAssembly/Pages/CallJsExample7.razor.cs Outdated Show resolved Hide resolved
7.0/BlazorSample_WebAssembly/Pages/CallJsExample7.razor.cs Outdated Show resolved Hide resolved
7.0/BlazorSample_WebAssembly/Pages/CallJsExample7.razor.cs Outdated Show resolved Hide resolved
8.0/BlazorSample_WebAssembly/Pages/CallJs7.razor.cs Outdated Show resolved Hide resolved
@hakenr
Copy link
Contributor Author

hakenr commented Oct 1, 2024

The presence of the spaces is intentional.

Oops, sorry, my Visual Studio's Format Document removed them.

@guardrex Are these spaces specific to the MS Learn platform? I don't recall ever seeing code formatted this way with intentional spaces at the end of a line (even if the statement continues on the next line).

@guardrex
Copy link
Collaborator

guardrex commented Oct 1, 2024

In most cases, the broken lines are present to conform code examples to the 85 char limit for display in articles. If a dev takes some code with cut-'n-paste, they may want to re-assemble the lines. If the space isn't there, they must manually add it back. I leave them there when I break lines as a minor convenience for those devs.

@guardrex
Copy link
Collaborator

guardrex commented Oct 1, 2024

Indeed! As I work through NIT code updates, I can see that VS is always fighting my effort to make recombining lines just a hair quicker by removing the space in these cases. I'm not going to seek to adjust editor config because there are many cases where I do want to end the line without a space.

I'll stick with my convention, but it is a super tiny NIT.

@hakenr
Copy link
Contributor Author

hakenr commented Oct 5, 2024

@guardrex This seems to be mergeable? I will create a pull-commit in aspnetdoc repo then.

@hakenr
Copy link
Contributor Author

hakenr commented Oct 5, 2024

(@guardrex The pull-commit to aspnetdoc already exists: dotnet/AspNetCore.Docs#33774)

@guardrex
Copy link
Collaborator

guardrex commented Oct 6, 2024

Yes, we're just waiting on Javier to look. If we don't hear from him here by RC2 release next week, I'll ping him to take a look at this on Wednesday ........ IF I'm still alive on Wednesday! Hurricane Milton might try to kill me 💀😨 next week (I live on the "Space Coast" in Florida).

@hakenr
Copy link
Contributor Author

hakenr commented Oct 7, 2024

Oh, sorry, I thought someone from PU had already seen it. No problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants