1 / 18

Multi-level Error Handling

Multi-level Error Handling. and logging within the ColdBox Platform. Kalen Gibbons. President of Sercossa Inc. A member of Team ColdBox. Co-Manager of IECFUG Flex, ColdFusion, JavaScript Developer. Catching Exceptions. Exception Levels. Process Level

hosea
Download Presentation

Multi-level Error Handling

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Multi-level Error Handling and logging within the ColdBox Platform

  2. Kalen Gibbons President of Sercossa Inc. A member of Team ColdBox Co-Manager of IECFUG Flex, ColdFusion, JavaScript Developer

  3. Catching Exceptions

  4. Exception Levels • Process Level • Manually handling anticipated errors per process • Try/catch blocks and transaction blocks • Handler Level • Catches all exceptions that occur at the handler level • Framework Level • Catch-all for uncaught exceptions from lower layers • Application Level • Last resort, a global handler for when even the framework is failing

  5. Process Level • Custom exception handling • For processes that are likely to fail • Use standard try/catch blocks • Example: anticipating failures • Example: database transaction

  6. Handler Level • Use onErrorconvention • function onError(event, action, exception) • Will handle majority of errors • Example: Model errors bubble up • Useful for catching errors specific to the handler • Example: REST handlers

  7. Framework Level • Catch-all (almost) for your application • Handles uncaught exceptions & those outside the scope of the handlers • Example: exception in interceptor

  8. Application Level • Absolute last resort • Useful when even the framework itself cannot run • No framework resource can be used • Example: Configuration issue

  9. Now What? what to do with captured exceptions Handle the issue to minimize disruption Log the Problem

  10. Minimizing Disruption A case study • Beta Users • Some users who have been accepted into a “beta” program receive early access to new features • The beta program is part of a SAAS solution • Your application uses a REST API provided by the SAAS solution to determine what features to show the user • If the SAAS solution has an outage, how does your application handle the exception?

  11. The Conundrum Log the error or respond gracefully? • Error need to bubble up to hit our logging code • This will terminate request • Handle the failure in the code • Then the error is not logged • It doesn’t have to be one or the other • ColdBox Interceptors • Announce event within the app • More flexibility than using LogBox directly

  12. Interceptor for Logging • Update all levels of error handling to announce the same event • Creates a centralized location for error logging • Attach as many interceptors as you need

  13. Managing Logs Get the most of your exception data

  14. Logging & Tracking Log Files Sending Emails • Is manageable • Is persistent • Is searchable • Allow notifications • Is manageable • Is persistent • Is searchable • Allow notifications Logging to Database Leveraging 3rd Party • Is manageable • Is persistent • Is searchable • Allow notifications • Is manageable • Is persistent • Is searchable • Allow notifications

  15. 3rd Party Logging • Consolidated logs from various sources • Server, application, etc. • Easy searching and reporting • Scalability and maintenance • Monitoring and notifications • Set thresholds to be notified of trouble • Monitor for specific events • Be notified of new (first-time) errors to quickly resolve new problems

  16. Logging Solutions • Logglyhttp://loggly.com/ • Amazon SimpleDBhttp://aws.amazon.com/simpledb/usecases_logging/ • LogClarityhttp://www.logfidelity.com/products.asp • EM7http://www.sciencelogic.com/em7-overview • Many More

  17. Putting it all Together Handle errors on Many Levels Log Intelligently • Process • Handler • Framework • Application • Announce events at the top 3 levels • Handler Application level error manually • Don’t interrupt your request to log problems • Choose a solution that’ll help you get the most out of your exception data.

  18. Thanks Kalen@Sercossa.com @KalenGibbons

More Related