Special Exception class that we encourage you to use in your Filters to indicate that something has gone wrong that cannot be recovered from.

Using this custom exception allows us to surface the messages you write on the exception directly to users to help them understand what went wrong.


 * Exception related to, and thrown by, Filters.
global class FilterException extends Exception {}


You can throw the exception outright if you know things are in a bad state.

Example 1

if(thingsAreBroken) {
    throw new valence.FilterException('Everything exploded!');

Example 2

Or you can wrap a low-level exception and add some context, giving us the best chance of surfacing an accurate error.

try {
catch(NullPointerException npe) {
    throw new valence.FilterException('Complex Operation failed.', npe);