0.1.0 • Published 11 years ago
format-throw v0.1.0
format-throw
Tiny utility to throw errors with formatted messages and support for custom error classes.
Installation
npm install --save format-throwUsage
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.
0.1.0
11 years ago
