Anonymous

What Is The Difference Between An Error And An Exception Handling?

3

3 Answers

Naureen Khan Profile
Naureen Khan answered
There is a slight difference between an Error and An Exception.      An error is a mistake is coding on the part of the programmer, so the program will not give the desired result.      For example, in ASP.NET there are different types of errors:    1) Configuration errors – These errors arise when the web.config or machine.config files are not formed properly.    2) Parser errors – Caused by incorrect tags and other syntax errors in the ASP.NET page.    3) Compilation errors – Raised during compilation due to mistakes in language syntax.    An exception is a run-time error that may occur due to wrong input type or other circumstance for example, running out of memory, not finding a required file, user inputting a string when a integer is required etc.    Errors are not handled they have to be fixed by the programmer in order for the application to work.  One the other hand, exceptions should be handled using exception handling code (try catch block as its called) so that the application does not crash, and the end user is, in a professional manner, informed that an error has occurred.    Any code that is liable to cause an exception i.e. Database connection, file reading etc. Is written within a TRY BLOCK.  If an exception does occur the CATCH block is executed where information can be examined about the type of exception raised, which line it was raised etc.
Anonymous Profile
Anonymous answered
Error is an incompatible condition that caused by runtime environments.
It is caused by incorrect tags in the programs. And we cannot repair at runtime.

  While exceptions are the conditions that occure runtime because of bad input etc.we can repair exception by using  try{ ...} and catch {..... } block..
Steve Fort Profile
Steve Fort answered

An Error "indicates serious problems
  that a reasonable application should
  not try to catch."

 

An Exception "indicates conditions
  that a reasonable application might
  want to catch."


Error along with Runtime Exception & their subclasses are
unchecked exceptions. All other Exception classes are checked
exceptions.

Answer Question

Anonymous