Skip to content

Commit cc69c2a

Browse files
committed
fix: Fix error detection (issue #9)
1 parent bc0e0c5 commit cc69c2a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/axiosBetterStacktrace.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ declare module 'axios' {
1818

1919
// toString used instead of instanceOf for detecting error type to prevent problem mentioned in issue #5
2020
const isError = (error: unknown): error is Error =>
21-
Object.prototype.toString.call(error) === '[object Error]';
21+
error instanceof Error || Object.prototype.toString.call(error) === '[object Error]';
2222

2323
const isAxiosError = (error: unknown): error is AxiosError =>
2424
isError(error) && (error as AxiosError).isAxiosError;

0 commit comments

Comments
 (0)