Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

System.Exception vs System.SystemException

Tags:

.net

What is the difference between System.Exception vs System.SystemException

like image 888
Vipster Avatar asked Feb 03 '10 05:02

Vipster


People also ask

What is the difference between system exception and application exception?

In 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.

What is a system exception?

SystemException is thrown by the common language runtime when errors occur that are nonfatal and recoverable by user programs. These errors result from failed runtime check (such as an array out-of-bound error), and can occur during the execution of any method.

What are system exceptions in C#?

The SystemException is a predefined exception class in C#. It is used to handle system related exceptions. It works as base class for system exception namespace. It has various child classes like: ValidationException, ArgumentException, ArithmeticException, DataException, StackOverflowException etc.

What is System exception Java?

The SystemException is thrown by the transaction manager to indicate that it has encountered an unexpected error condition that prevents future transaction services from proceeding.


1 Answers

A SystemException is usually reserved for the .NET runtime/framework to use, and not your application code. Basically, don't derive from SystemException when creating your own custom Exception class.

If you are creating your own Exception classes, you should either derive them from Exception or ApplicationException. ApplicationException was originally intended to be used for non-framework exceptions, but it has sort of fallen to the wayside. I believe the framework authors now recommend to derive your custom Exceptions from the base Exception class.

like image 75
Andy White Avatar answered Oct 12 '22 20:10

Andy White