1. Home
  2. DevOps
  3. Standards
  4. Exception Handling

Exception Handling

Exception handling is how developers determine why code is failing. The message of the exception, the location telemetry, and the type of exception are important for determining the exact cause.

Logging exceptions

When logging an exception, there are several rules that must be followed to ensure that all exceptions thrown are useful.

  1. Never throw an unhandled exception. Unhandled exceptions cause the entire application to crash.
  2. Never assign an exception that isn’t being used. This generates unnecessary warnings and can cause problems down the line. Exceptions can be caught and ignored, but in that case, there is no point assigning it to a variable.
  3. Add meaningful messages to errors that are being logged. This provides developers with location and cause information. The more meaningful the message, the more it can help developers to determine where the exception occurred.

Storing exceptions

When exceptions are logged, they must be stored somewhere. GreatIdeaz stores exceptions in two primary locations. The first location is a table in the database accessible through the trellispark application. The second location is an external Microsoft Application Insights telemetry client. Both locations store information on the location of the error, the message, a stack trace, the user who caused the error, and the time that the error was caused.

Updated on May 12, 2022

Was this article helpful?

Related Articles

Need Support?
Can’t find the answer you’re looking for? Don’t worry we’re here to help!
Contact Support

Leave a Comment