View on GitHub

Whiteflag JavaScript Library

Reference implementation of the Whiteflag protocol in TypeScript / JavaScript

WFJSL Error Handling

WFJSL Documentation Home WFJSL TypeDoc Reference Whiteflag Specification

Overview

In addition to the standard JavaScript Error class, WFJSL provides an additional error class for Whiteflag protocol errors: the WfProtocolError class for the handling of Whiteflag message format and protocol errors.

Usage of error classes

To use the WfProtocolError class, import it with an object destructor:

const { WfProtocolError } = require('whiteflag-js');

and define a new error as needed:

err = new WfProtocolError(message, causes, code);

with the following arguments:

ProtocolError class error codes