All notable changes will be documented in this file.
ono
adheres to Semantic Versioning.
v7.1.0 (2020-03-03)
- Added a static
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 forJSON.stringify()
, etc.
v7.0.0 (2020-02-16)
-
Moved Ono to the @JSDevTools scope on NPM
-
The "ono" NPM package is now just a wrapper around the scoped "@jsdevtools/ono" package
v6.0.0 (2019-12-28)
-
Dropped support for IE8 and other JavaScript engines that don't support
Object.getOwnPropertyDescriptor()
-
Removed
ono.formatter
. It has been replaced with theformat
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 baseError
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
v5.1.0 (2019-09-10)
- Added a static
Ono.toJSON()
method that accepts anyError
(even a non-Ono error) and returns a POJO that can be used withJSON.stringify()
. Ono errors already have a built-intoJSON()
method, but this exposes that enhanced functionality in a way that can be used with any error.
v5.0.0 (2019-02-18)
- Ono errors previously included an
inspect()
method to support Node'sutil.inspect()
function. As of Node v6.6.0, theinspect()
method is deprecated in favor of autil.inspect.custom
. Ono has updated accordingly, so errors no longer have aninspect()
method.
- We no longer automatically include a polyfill for Node's
util.format()
function. We recommend using ES6 template strings instead. Or you can import a polyfill yourself and assign it to theono.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/orprops
objects has Symbol-keyed properties, they will be copied to the Ono error.
v4.0.0 (2017-07-07)
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.
v3.1.0 (2017-06-01)
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()
.
v3.0.0 (2017-06-01)
- Updated all dependencies and verified support for Node 8.0
- Ono no longer appears in error stack traces, so errors look like they came directly from your code
v2.0.0 (2015-12-14)
- Did a major refactoring and code cleanup
- Support for various browser-specific
Error.prototype
properties (fileName
,lineNumber
,sourceURL
, etc.) - If you define a custom
toJSON()
method on an error object, Ono will no longer overwrite it - Added support for Node's
util.inspect()