22.08.2013 Views

ColdFusion Developer's Guide

ColdFusion Developer's Guide

ColdFusion Developer's Guide

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta<br />

Type Type name Description<br />

Application-defined<br />

exception events<br />

raised by cfthrow<br />

Custom exceptions<br />

You can generate an exception with your own type by specifying a custom exception type<br />

name, for example MyCustomErrorType, in a cfthrow tag. You then specify the custom type<br />

name in a cfcatch or cferror tag to handle the exception. Custom type names must be<br />

different from any built-in type names, including basic types and Java exception classes.<br />

Advanced exception types<br />

The Advanced exceptions consist of a set of specific, narrow exception types. These types are<br />

supported in <strong>ColdFusion</strong> for backward-compatibility. For a list of advanced exception types,<br />

see “Advanced Exception types” in Chapter 3, “<strong>ColdFusion</strong> Tags,” in CFML Reference.<br />

Java exception classes<br />

Every <strong>ColdFusion</strong> exception belongs to, and can be identified by, a specific Java exception<br />

class in addition to its basic, custom, or advanced type. The first line of the stack trace in the<br />

standard error output for an exception identifies the exception’s Java class.<br />

For example, if you attempt to use an array function such as ArrayIsEmpty on an integer<br />

variable, <strong>ColdFusion</strong> generates an exception that belongs to the Expression exception basic<br />

type and the coldfusion.runtime.NonArrayException Java class.<br />

In general, most applications do not need to use Java exception classes to identify exceptions.<br />

However, you can use Java class names to catch exceptions in non-CFML Java objects; for<br />

example, the following line catches all Java input/output exceptions:<br />

<br />

Application Custom exceptions generated by a cfthrow<br />

tag that do not specify a type, or specify the<br />

type as Application.<br />

All exceptions Any Any exceptions. Includes all types in this table<br />

and any exceptions that are not specifically<br />

handled in another error handler, including<br />

unexpected internal and external errors.<br />

NOTE<br />

The Any type includes all error with the Java object type of java.lang.Exception. It does<br />

not include java.lang.Throwable errors. To catch Throwable errors, specify<br />

java.lang.Throwable in the cfcatch tag type attribute.<br />

Understanding errors 367

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!