Skip to content

Commit e01bf44

Browse files
committed
Improved exception handling when the Observable error is in the code, not the http response.
1 parent 944cc9f commit e01bf44

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/infrastructure/Http.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,10 @@ export abstract class Http {
7979
if (error.code && error.address && error.code === 'ECONNREFUSED') {
8080
return new Error(`Cannot reach node: ${error.address}:${error.port}`);
8181
}
82-
return error;
82+
if (error instanceof Error) {
83+
return error;
84+
}
85+
return new Error(error);
8386
}
8487

8588
/**

0 commit comments

Comments
 (0)