2 ms·
Take for example some Null exception where the system is expecting a value but the value is null. If it's safe for the user to proceed with a default or empty
by fareesh 4y ago
Take for example some Null exception where the system is expecting a value but the value is null.
If it's safe for the user to proceed with a default or empty value, then you can probably log the error and proceed. For example if you have a page which shows a post, and for some reason the author's name is null, you could probably show the page and not display the element containing the author's name, that way the user can at least read the post.
If it's not safe to continue - say the post body itself is null for some reason, you can throw an exception as well and show the user an error.
In both cases, especially the latter, you'll want to have some kind of monitoring enabled that notifies you of the problem along with the relevant logging of context that will help you diagnose the source of the problem.