1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113
|
=== tests/cases/compiler/errorCause.ts ===
declare const a: unknown;
>a : unknown
let err = new Error("foo", { cause: new Error("bar") });
>err : Error
>new Error("foo", { cause: new Error("bar") }) : Error
>Error : ErrorConstructor
>"foo" : "foo"
>{ cause: new Error("bar") } : { cause: Error; }
>cause : Error
>new Error("bar") : Error
>Error : ErrorConstructor
>"bar" : "bar"
err.cause;
>err.cause : any
>err : Error
>cause : any
let anotherErr = new Error("foo", { cause: a });
>anotherErr : Error
>new Error("foo", { cause: a }) : Error
>Error : ErrorConstructor
>"foo" : "foo"
>{ cause: a } : { cause: unknown; }
>cause : unknown
>a : unknown
anotherErr.cause;
>anotherErr.cause : any
>anotherErr : Error
>cause : any
new EvalError("foo", { cause: new Error("bar") });
>new EvalError("foo", { cause: new Error("bar") }) : EvalError & Error
>EvalError : EvalErrorConstructor
>"foo" : "foo"
>{ cause: new Error("bar") } : { cause: Error; }
>cause : Error
>new Error("bar") : Error
>Error : ErrorConstructor
>"bar" : "bar"
new EvalError("foo", { cause: a });
>new EvalError("foo", { cause: a }) : EvalError & Error
>EvalError : EvalErrorConstructor
>"foo" : "foo"
>{ cause: a } : { cause: unknown; }
>cause : unknown
>a : unknown
new RangeError("foo", { cause: new Error("bar") });
>new RangeError("foo", { cause: new Error("bar") }) : RangeError & Error
>RangeError : RangeErrorConstructor
>"foo" : "foo"
>{ cause: new Error("bar") } : { cause: Error; }
>cause : Error
>new Error("bar") : Error
>Error : ErrorConstructor
>"bar" : "bar"
new ReferenceError("foo", { cause: new Error("bar") });
>new ReferenceError("foo", { cause: new Error("bar") }) : ReferenceError & Error
>ReferenceError : ReferenceErrorConstructor
>"foo" : "foo"
>{ cause: new Error("bar") } : { cause: Error; }
>cause : Error
>new Error("bar") : Error
>Error : ErrorConstructor
>"bar" : "bar"
new SyntaxError("foo", { cause: new Error("bar") });
>new SyntaxError("foo", { cause: new Error("bar") }) : SyntaxError & Error
>SyntaxError : SyntaxErrorConstructor
>"foo" : "foo"
>{ cause: new Error("bar") } : { cause: Error; }
>cause : Error
>new Error("bar") : Error
>Error : ErrorConstructor
>"bar" : "bar"
new TypeError("foo", { cause: new Error("bar") });
>new TypeError("foo", { cause: new Error("bar") }) : TypeError & Error
>TypeError : TypeErrorConstructor
>"foo" : "foo"
>{ cause: new Error("bar") } : { cause: Error; }
>cause : Error
>new Error("bar") : Error
>Error : ErrorConstructor
>"bar" : "bar"
new URIError("foo", { cause: new Error("bar") });
>new URIError("foo", { cause: new Error("bar") }) : URIError & Error
>URIError : URIErrorConstructor
>"foo" : "foo"
>{ cause: new Error("bar") } : { cause: Error; }
>cause : Error
>new Error("bar") : Error
>Error : ErrorConstructor
>"bar" : "bar"
new AggregateError([], "foo", { cause: new Error("bar") });
>new AggregateError([], "foo", { cause: new Error("bar") }) : AggregateError
>AggregateError : AggregateErrorConstructor
>[] : undefined[]
>"foo" : "foo"
>{ cause: new Error("bar") } : { cause: Error; }
>cause : Error
>new Error("bar") : Error
>Error : ErrorConstructor
>"bar" : "bar"
|