Files
common/packages/util/docs/ext.md
T
Jaco Greeff 99b86d9849 Use ES6 import/export (#139)
* Use ES6 import/export

* Fix tests
2018-06-20 16:36:07 +02:00

607 B

ext

Extensions to basic classes

  • ExtError Extension to the basic JS Error.

ExtError

Extension to the basic JS Error.

ExtError (message: string = '', code: number = UNKNOWN_ERROR, value: any)

The built-in JavaScript Error class is extended by adding a code to allow for Error categorization. In addition to the normal stack, message, the numeric code and data (mixed types) parameters are available on the object.

const { ExtError } from '@polkadot/util');

throw new ExtError('some message', ExtError.CODES.METHOD_NOT_FOUND); // => error.code = -32601