|
|
|
|
|
by CGamesPlay
226 days ago
|
|
I'm gonna plug my favorite note on this topic: https://ericlippert.com/2008/09/10/vexing-exceptions/ Both snippets suffer from being too limited. The first, as you point out, catches too many exceptions. But the second.... What happens if the email address is taken? That's hardly exceptional, but it's an exception that the caller has to handle. Your natural response might be to check if the email address is taken before calling register, but that's just a race condition now. So you really need a result-returning function, or to catch some (but probably not all) of the possible exceptions from the method. |
|