View on GitHub

Whiteflag Java Library

Implementation of the Whiteflag Protocol for Java development

WFJL Error Handling

Go back to the WFJL Documentation Home or visit the detailed WFJL Javadoc API Reference

Overview

In addition to the standard Java exception classes, the WFJL extends the Java Exception class for Whiteflag specific errors:

Software using the library should typcially only expect the WfException class to be thrown. The other error classes are primarily used internally.

Error Class Diagram

The class diagram gives a rough overview of the error classes. It is not intended as a complete or accurate reference Instead, please see the WFJL Javadoc API Reference for all details.

WFJL Error Class Diagram

Detailed Implementation

Error Classes

The core package defines the WfCoreException class, that is thrown by its classes if any request is made that is not in accordance with the Whiteflag specification, e.g. when a field value is not allowed or is not correctly formatted for a specfic field.

The main package org.whiteflagprotocol.java that provides the external interface, uses the WfExcepetion class. The WfException class has a property indicating the type of error. The error types are defined by the nested enumeration WfException.ErrorType.

Error Types

The WfException.ErrorType enum defines the following error codes:

Usage

Example

An example where a Whiteflag exception is thrown during authentication of an originator:

throw new WfException("Invalid authentication data", null, WfException.ErrorType.WF_AUTH_ERROR);

Note the second argument, which is a Throwable indicating the underlying cause. It may be null if unknown or not existent.