Difference between system level exception and Application level exception.

CsharpServer Side ProgrammingProgramming

As we know that exception is something that refers to the interruption in the flow of program or application. This unwanted event is known as Exception and is generally gives the indication regarding something wrong within the code. Basically particularly in language C# an exception can be a System or an Application Level exception. So on the basis

Sr. No.KeySystem level exceptionApplication level exception
1DerivationSystem exceptions are derived from the base class System.SystemException which in itself is a derived class of SystemException.On other hand Application-level exceptions are derived from the base class System.ApplicationException which is again a derived class of SystemException
2OccurrenceIn general System exceptions occurred whenever some non-recoverable or fatal error is encountered, like a database crash, bound errors etc.While in case of Application level exceptions some error which is recoverable is encountered, for instance, the wrong type of input data, arithmetic exceptions etc.
3HandlingAs error in case of system level exception is fatal so there is no such handing for these type of exceptions or method to prevent them.On other hand as application level exceptions are generally handled at the code level using try-catch blocks. If the code does not have a try and catch block for the occurred exception then it propagates to the page level where the Page_Error routine can be used to handle the exception
4CustomizationException customization is not supported in case of System level exception.On other hand we can define and declare the custom application level exceptions.
5GenerationAs mentioned in above points system level exceptions are thrown by the .NET Common Language Runtime and used in almost all .Net applications.On other hand application level exceptions are thrown when a recoverable error has occurred, such as an invalid input argument values to a business method. It will alert the client of application specific or business logic issues.
Published on 10-Jan-2020 12:09:16