File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ export function isAtLeastReact17(reactVersion: string): boolean {
16
16
* Recurse through `error.cause` chain to set cause on an error.
17
17
*/
18
18
export function setCause ( error : Error & { cause ?: Error } , cause : Error ) : void {
19
- const seenErrors = new WeakMap < Error , boolean > ( ) ;
19
+ const seenErrors = new WeakSet ( ) ;
20
20
21
21
function recurse ( error : Error & { cause ?: Error } , cause : Error ) : void {
22
22
// If we've already seen the error, there is a recursive loop somewhere in the error's
@@ -25,7 +25,7 @@ export function setCause(error: Error & { cause?: Error }, cause: Error): void {
25
25
return ;
26
26
}
27
27
if ( error . cause ) {
28
- seenErrors . set ( error , true ) ;
28
+ seenErrors . add ( error ) ;
29
29
return recurse ( error . cause , cause ) ;
30
30
}
31
31
error . cause = cause ;
You can’t perform that action at this time.
0 commit comments