What is the difference between an error and an exception in .NET?

前端 未结 8 1898
说谎
说谎 2021-02-02 12:28

Could you please explain to me what the difference is between an error and an exception?

8条回答
  •  说谎
    说谎 (楼主)
    2021-02-02 13:07

    If no exception handler for a given exception is present, the program stops executing with an error message.

    Unhandled Exceptions are Errors. So All Errors are Exceptions but the reverse is not true. Exception Handlings technique handles the Exception/Unexpected Situations(Errors), While errors are Situations which we havenot expected to occur so explicitly we have to take care of them by redirectly the User(s) to some static HTML Page & capturing it into Logs & come up with a Solution for the Error occured.

    Errors Can Occur at 2 Levels

    • Page Level( use ErrorPage Attribute at the page Directive)
    • Application Level(Need to be Handled in web.config)

    Compilation CustomError ... CustomError error.... error Compilation Note- Page Level Error handling overrides the Application Level Error Handling.

    Exception Handling:->

    • Locally (Method Level)

      • Page Level
      • Aplication Level
      • Http module Level.

      Will Link-> http://msdn.microsoft.com/en-us/library/ms173160(v=vs.80).aspx

提交回复
热议问题