Skip to content

What's the difference between Errors and Exceptions?

Daisho Komiyama edited this page Feb 8, 2022 · 2 revisions

Errors

Errors are usually raised by the environment in which the application is running. For example, an error will occur due to a lack of system resources.

JavaScript throws Errors

  • It is not possible to recover from an error (unrecoverable)
  • Errors occur at run-time and are not known by the compiler; hence, they are classified as "unchecked"
  • "OutOfMemory" and "StackOverflow" are examples of errors

Exceptions

Exceptions are caused by the code of the application itself.

Developers throw Exceptions

  • The use of try-catch blocks can handle exceptions and recover the application from them (recoverable)
Clone this wiki locally