File tree Expand file tree Collapse file tree 1 file changed +6
-0
lines changed
Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,11 @@ import type { Info, Plugin } from 'modern-errors'
66 */
77export type { Options }
88
9+ // `error.beautiful()` is called with `errorString` as argument by
10+ // `beautiful-error`. We ignore that argument and prevent it from being
11+ // considered an invalid options object.
12+ const isOptions = ( options : unknown ) => typeof options !== 'string'
13+
914const getOptions = ( options : Options = { } ) => {
1015 // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
1116 validateOptions ( options )
@@ -41,6 +46,7 @@ const beautiful = ({ error, options }: Info<Options>['instanceMethods']) =>
4146 */
4247const modernErrorsBeautiful = {
4348 name : 'beautiful' as const ,
49+ isOptions,
4450 getOptions,
4551 instanceMethods : { beautiful } ,
4652} satisfies Plugin
You can’t perform that action at this time.
0 commit comments