What is Exception Handling ?
Exception handling is very important in dotnet because this is a coding structure based on variables
and basic programming structure.
Here , Dotnet framework is providing us a method to check unwanted errors from our development and coding.
We are implementing it using 3 blocks of code :
1. try :
This block is used to complete the task.
2. catch (exception ex)
This block carries the exception and here we can also catch any exception occurring in the code.
3. finally
This block is the final code to be executed when certain error occurs in our code structure.
What is inner class exception in Dotnet and how we handle the same?
Whenever there is an exception which depend on another exception it is termed as inner exception handling.
For Example :
Exception 1 : We want to write the exception in a log file and send it to client.
Exception 2 : We want to divide by Zero some integer value.
So in this scenario we need to implement the solution using inner class exception. To use this exception we will use a constructor of exception class.
Can we create our own Exception class and how?
Yes we can easily create exception class defined by us and add our own exception which we cant get
in standard dotnet framework class. We will achieve this using Inheritance concept which is
inheriting from dotnet exception class.
What is abusing in exception handling?
Abusing exception handling means for one program you need to write multiple catch blocks.
see for example.
No comments:
Post a Comment