Skip to content
This repository has been archived by the owner on Feb 14, 2020. It is now read-only.

Commit

Permalink
Update README with name cases
Browse files Browse the repository at this point in the history
  • Loading branch information
causal-agent committed Mar 10, 2015
1 parent 50dfbba commit a97311d
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,14 @@ Option keys missing from `options` are left unchanged.
Register an error constructor for serialization and deserialization with
option overrides.

The error name can be passed in `options.name`, otherwise it is inferred by
instantiating the constructor with no arguments.
The error name will be taken from the first of these that is set:

1. `options.name`
2. `constructor.prototype.name`, if it is not 'Error'
3. `constructor.name`
4. `new constructor().name`

Note that in the last case, the constructor is instantiated with no arguments.

All [built-in error classes][builtins] are automatically registered with
no option overrides.
Expand Down

0 comments on commit a97311d

Please sign in to comment.