8.1. Exceptions

From our work in ColdFusion, we know what exceptions are, when to use them, and what's important about them. They help us write user-friendly code. They keep us honest about what sorts of things can happen in a production environment, and they help us handle such eventualities gracefully. This section should be pretty easy to grasp, as it is one of the places where ColdFusion and Java sort of see eye to eye.

We often talk about “handling exceptions” and “catching exceptions.” While these are accurate terms, it is probably not a bad idea to shift our thinking a bit. Exception handling is a form of flow control, like a <cflocation>, <cfabort>, or even a switch statement. A switch statement says, “if this is the case at this time, ...

Get Java™ for ColdFusion® Developers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.