ft

format-throw

Throw errors with formatted messages and support for custom error classes

Showing:

Popularity

Downloads/wk

1

GitHub Stars

0

Maintenance

Last Commit

6yrs ago

Contributors

1

Package

Dependencies

1

Size (min+gzip)

0.7KB

License

MIT

Type Definitions

Tree-Shakeable

No?

Categories

Readme

format-throw

Build Status Coverage Status Dependency Status devDependency Status

NPM

Tiny utility to throw errors with formatted messages and support for custom error classes.

Installation

npm install --save format-throw

Usage

var thr = require('format-throw');

// Throw a TypeError
thr(TypeError, '%s is not %s', 'foo', 'bar');

// Throw a default Error
thr('The meaning of life is %d', 42);

// Return the error instance instead of throwing it
var err1 = thr.make(TypeError, 'meaningOfLife should be %d', '42');
var err2 = thr.make("Inked %s ain't %s", 'donkeys', 'zebras');

Contributing

Take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using grunt test.

License

Copyright (c) 2015 Felix Zandanel
Licensed under the MIT license.

See LICENSE for more info.

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100