@@ -35,10 +35,12 @@ process.
3535[ ` modern-errors ` ] ( https://github.com/ehmicky/modern-errors ) .
3636
3737``` js
38- import modernErrors from ' modern-errors'
38+ import ModernError from ' modern-errors'
3939import modernErrorsCli from ' modern-errors-cli'
4040
41- export const BaseError = modernErrors ([modernErrorsCli])
41+ export const BaseError = ModernError .subclass (' BaseError' , {
42+ plugins: [modernErrorsCli],
43+ })
4244// ...
4345```
4446
@@ -77,7 +79,7 @@ not `require()`.
7779_ Type_ : ` Plugin `
7880
7981Plugin object to
80- [ pass to ` modernErrors ()` ] ( https://github.com/ehmicky/modern-errors#adding-plugins ) .
82+ [ pass to the ` plugins ` option of ` ErrorClass.subclass ()` ] ( https://github.com/ehmicky/modern-errors#adding-plugins ) .
8183
8284## error.exit()
8385
@@ -168,34 +170,26 @@ Special values:
168170[ Options] ( #options ) can apply to (in priority order):
169171
170172- Any error: second argument to
171- [ ` modernErrors() ` ] ( https://github.com/ehmicky/modern-errors#modernerrorsplugins-options )
172-
173- ``` js
174- export const BaseError = modernErrors (plugins, { cli: { ... options } })
175- ```
176-
177- - Any error of multiple classes: using
178- [ ` ErrorClass.subclass() ` ] ( https://github.com/ehmicky/modern-errors#baseerrorsubclassname-options )
173+ [ ` ModernError.subclass() ` ] ( https://github.com/ehmicky/modern-errors#options-1 )
179174
180175``` js
181- export const SharedError = BaseError .subclass (' SharedError' , {
176+ export const BaseError = ModernError .subclass (' BaseError' , {
177+ plugins: [modernErrorsCli],
182178 cli: { ... options },
183179})
184-
185- export const InputError = SharedError .subclass (' InputError' )
186- export const AuthError = SharedError .subclass (' AuthError' )
187180```
188181
189- - Any error of a specific class: second argument to
190- [ ` BaseError .subclass()` ] ( https://github.com/ehmicky/modern-errors#baseerrorsubclassname- options )
182+ - Any error of a specific class (and its subclasses) : second argument to
183+ [ ` ErrorClass .subclass()` ] ( https://github.com/ehmicky/modern-errors#options-1 )
191184
192185``` js
193186export const InputError = BaseError .subclass (' InputError' , {
194187 cli: { ... options },
195188})
196189```
197190
198- - A specific error: second argument to the error's constructor
191+ - A specific error: second argument to
192+ [ ` new ErrorClass() ` ] ( https://github.com/ehmicky/modern-errors#options-3 )
199193
200194``` js
201195throw new InputError (' ...' , { cli: { ... options } })
0 commit comments