BoxLang, like Java, has an exception hierarchy, in addition to the ability to declare custom runtime exceptions. The following are common exceptions thrown by the BoxLang Runtime.
ScopeNotFoundException
This exception is thrown when a scope is requested that does not exist in the current runtime build
This exception might be encountered, for example, in a non-web runtime when attempting to access web-specific scopes like URL
or FORM
MissingIncludeException
This exception is thrown when a an included template file cannot be located.
DatabaseException
This exception is the base exception for all database-related errors in the BoxLang runtime.
ConfigurationException
This exception is thrown when an error is encountered during the configuration of the BoxLang runtime or its modules
NoFieldException
This exception is thrown when a field is requested on a Java class that does not exist.
ClassNotFoundBoxLangException
This exception is thrown when a class cannot be found in the BoxLang runtime.
It is most often encountered when attempting to use a struct that has not been declared or is not avaialable in the current scope
LockException
This exception is thrown when a locking operation fails - either with a failure to obtain the lock or due to a timeout
NoConstructorException
This exception is thrown when no constructor is found on a Dynamic Object
It is most often encountered when attempting to construct a Java class with arguments that do not match any of the constructors
ParseException
This exception is encountered when parsing of a source file fails.
CustomException
This is the base exception class for all custom exceptions thrown by the user.
All dynamically declared exceptions will extend this class
ExpressionException
This is the base exception for all expression or evaluation errors in the BoxLang runtime.
BoxRuntimeException
This is the base exception thrown by the BoxLang runtime.
It is a runtime exception, so it does not need to be declared in the method signature of classes or methods which throw it
KeyNotFoundException
The exception thrown when a key cannot be located within a struct
BoxIOException
This exception is thrown when an IO operation fails.
The underlying Java IOException exception is parsed and is used to provide a more user-friendly message.
NoMethodException
This exception is thrown when attempting to access a method on a java class that does not exist, is not accessible or does not match the arguments
BoxCastException
This exception is thrown when an attempt to cast a value to a specific Java type fails.
Most often it is seen when strongly typed arguments or attributes are used in a way that is not compatible with the expected type.
AbstractClassException
This exception is thrown when an abstract class is instantiated.
NoElementException
This exception is thrown when a variable is accessed that does not exist
UnmodifiableException
This exception is thrown when a modification attempt is made upon an unmodifiable (e.g.
final) object
BoxValidationException
This is exception is thrown when an attempt to validate inbound attributes or arguments fails.
Validation upon these attributes or arguments is declared within the respective component or BIF.