All notable changes will be documented in this file.
ono adheres to Semantic Versioning.
Ono.extend() method that allows Ono to extend errors that were created outside of Ono. The extended error gets all the Ono functionality, including nested stack traces, custom properties, improved support for JSON.stringify(), etc.Moved Ono to the @JSDevTools scope on NPM
The "ono" NPM package is now just a wrapper around the scoped "@jsdevtools/ono" package
Dropped support for IE8 and other JavaScript engines that don't support Object.getOwnPropertyDescriptor()
Removed ono.formatter. It has been replaced with the format option
When using the default ono() function to wrap an error, it will now try to match the error's type, rather than simply using the base Error class.
The Ono constructor now accepts an optional options parameter, which lets you customize the behavior of Ono
The concatMessages option lets you control whether the original error's message is appended to your error message
The format option lets you provide a custom function for replacing placeholders in error messages
Ono.toJSON() method that accepts any Error (even a non-Ono error) and returns a POJO that can be used with JSON.stringify(). Ono errors already have a built-in toJSON() method, but this exposes that enhanced functionality in a way that can be used with any error.inspect() method to support Node's util.inspect() function. As of Node v6.6.0, the inspect() method is deprecated in favor of a util.inspect.custom. Ono has updated accordingly, so errors no longer have an inspect() method.util.format() function. We recommend using ES6 template strings instead. Or you can import a polyfill yourself and assign it to the ono.formatter property.Completely rewritten in TypeScript.
Ono is now completely dependency free.
You can now create your own Ono functions for custom error classes. See the docs for details.
Symbol-keyed properties are now supported. If the originalError and/or props objects has Symbol-keyed properties, they will be copied to the Ono error.
The err parameter (see the API docs) can now be any type of object, not just an instanceof Error. This allows for errors that don't extend from the Error class, such as DOMError, DOMException, and custom error types.
NOTE: This should not be a breaking change, but I'm bumping the major version number out of an abundance of caution.
We removed the direct dependency on Node's util.format(), which was needlessly bloating the browser bundle. Instead, I now import format-util, which a much more lightweight browser implementation. There's no change when running in Node.js, because format-util simply exports util.format().
Error.prototype properties (fileName, lineNumber, sourceURL, etc.)toJSON() method on an error object, Ono will no longer overwrite itutil.inspect()