dotnet / docs

This repository contains .NET Documentation.
https://learn.microsoft.com/dotnet
Creative Commons Attribution 4.0 International
4.28k stars 5.91k forks source link

Conflicting recommendations for throwing system.exception #35262

Open Greydog1 opened 1 year ago

Greydog1 commented 1 year ago

This page gives an example using Throw system.exception, while this page says not to throw system.exception.


Document Details

Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.

BillWagner commented 1 year ago

Thanks for reporting this @Greydog1

This page should change to use a different exception type.

I'll add this to our backlog, and add the "help-wanted" label in case someone wants to submit a PR before we make the change.

shivam-51 commented 1 year ago

This page gives an example using Throw system.exception,

Which is "This" page?

pkulikov commented 1 year ago

@shivam-51 It's the following page, which is mentioned in the original post in the Document Details section: https://learn.microsoft.com/en-us/dotnet/visual-basic/language-reference/statements/throw-statement

image

shivam-51 commented 1 year ago

This page should change to use a different exception type.

@BillWagner What can be the different exception type? I feel the purpose of that document is to show how to throw a generic exception and it does so. If we want to replace it we need to add a generic exception instead of the Exception.

BartoszKlonowski commented 1 year ago

@BillWagner I'll work on this!