Monday, April 22, 2013

Exception Handling : What should be done and when


From CodeProject : http://www.codeproject.com/Articles/85569/Exception-Handling-in-3-Tier-Architecture


Scenario
Description
Expected Result
1
Application called a stored procedure.
Happy path; everything should work fine.
2
Exception Raised by Database Management System such as Primary Key violated or Object does not exist, etc.
System should log the thrown exception in a sink (Text File). Replace the Exception with a User friendly Message and propagate it to UI passing through the Business Logic Layer.
3
Based upon some certain validation check / business rule a Custom Error is raised from Stored Procedure.
Thrown Custom Error message should be propagated to UI without Logging assuming these error messages will be some kind of alternative flows instead of real exception.
4
While processing the request, an error occurred in Business Logic such as Divide-by-zero, Object not set, Null reference exception, etc.
System should log the thrown exception in a sink (Text File). Replace the Exception with a User friendly Message and should propagate that to UI.
5
Based upon some certain business validation check, a custom exception was thrown from Business Logic Layer.
Thrown Custom Error message should be propagated to UI without Logging assuming these error messages will be some kind of alternative flows instead of real exception.
6
While processing the request an error occurred in UI. For example, Nullreference exception, etc.
System should log the thrown exception in a sink (Text File). Replace the Exception with a User friendly Message and should propagate that to UI.


No comments:

Post a Comment

 using Microsoft.AspNetCore.Mvc; using System.Xml.Linq; using System.Xml.XPath; //<table class="common-table medium js-table js-stre...