File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -72,9 +72,15 @@ export class SensitiveInfoError extends Error {
7272 message : string ,
7373 options ?: { cause ?: unknown }
7474 ) {
75- super ( message , options )
75+ super ( message )
7676 this . name = 'SensitiveInfoError'
7777 this . code = code
78+ // Assign `cause` directly instead of passing it to `super()` so this
79+ // compiles cleanly under TS configs whose `lib` predates ES2022 (where
80+ // the second `Error` constructor argument was introduced).
81+ if ( options && 'cause' in options ) {
82+ ; ( this as { cause ?: unknown } ) . cause = options . cause
83+ }
7884 }
7985}
8086
Original file line number Diff line number Diff line change @@ -38,10 +38,16 @@ export class HookError extends Error {
3838 message : string ,
3939 { cause, operation, hint } : HookErrorOptions = { }
4040 ) {
41- super ( message , { cause } )
41+ super ( message )
4242 this . name = 'HookError'
4343 this . operation = operation
4444 this . hint = hint
45+ // Assign `cause` directly instead of passing it to `super()` so this
46+ // compiles cleanly under TS configs whose `lib` predates ES2022 (where
47+ // the second `Error` constructor argument was introduced).
48+ if ( cause !== undefined ) {
49+ ; ( this as { cause ?: unknown } ) . cause = cause
50+ }
4551 }
4652}
4753
You can’t perform that action at this time.
0 commit comments