Quick Tip: What to do when your error handling isn't working?

Two quick things you should check when your error handling isn’t working right.

1) Make sure your error handler doesn’t have a bug itself. A good example of this is an error handler that sends a report to application.adminEmail. If your error occurs in application startup, before application.adminEmail is set, then it is no surprise that your error handler would fail as well. Suggestion: Make your error handler as simple as possible. Just a “Something is wrong” text message. If that helps, then the error is in your error handler.

2) ColdFusion’s error handler won’t handle syntax errors like so: <cfsearch collection=”cfdocs” criteria=”cfabort and name=”res”>. Notice that the criteria attribute doesn’t properly end? Suggestion: Look at the error message. It may look something like this: Invalid token “ found on line 2 at column 62. The invalid token is a hint. Also try just using your IDE. CFEclipse’s synax checker isn’t perfect, but many times it does flag a syntax error and I just don’t notice it.

Raymond Camden's Picture

About Raymond Camden

Raymond is a developer advocate. He focuses on JavaScript, serverless and enterprise cat demos. If you like this article, please consider visiting my Amazon Wishlist or donating via PayPal to show your support.

Lafayette, LA https://www.raymondcamden.com

Comments