Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

13
  • If you use exceptions, is their sole purpose to stop work and notify the user of an error, or does useful work (other than user notification) occur after any of the exceptions? Commented Apr 29, 2020 at 16:07
  • If you were not restrained by the maxim "don't use exceptions for flow control," would exceptions be your preferred mechanism here? Commented Apr 29, 2020 at 16:09
  • I can't think of a practical case where I do anything but display the error to the user. However I don't want to "stop" work. I want to enable the form so he can try again or click something else. I don't want the app to crash (in the Blazor's case it would display the Reload button) Commented Apr 29, 2020 at 16:10
  • 1
    I would put that kind of activity under the heading "handling an error." Which is exactly what exceptions are for. Commented Apr 29, 2020 at 16:26
  • Maybe but then what? Just wrap every call in try/catch and add the handling in each catch? I'd rather have ifs in this case. It seems to me that the exceptions approach would be good if I find a way to let them bubble up and use a common handler that works in all forms. Maybe a message bus and let the forms subscribe to messages and force them to have Unlock method which enables the controls? Commented Apr 29, 2020 at 16:42