From c15bbe81a76c3d0b759ebf479ac11dec3523eae4 Mon Sep 17 00:00:00 2001 From: tabarra Date: Tue, 6 Oct 2020 23:02:13 -0300 Subject: [PATCH] Changed error.stack type checking (resolves #1490) --- source/core/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/core/index.ts b/source/core/index.ts index 8b8b0966e..eb845facf 100644 --- a/source/core/index.ts +++ b/source/core/index.ts @@ -1222,7 +1222,7 @@ export class RequestError extends Error { this.timings = this.request?.timings; // Recover the original stacktrace - if (!is.undefined(error.stack)) { + if (is.string(error.stack)) { const indexOfMessage = this.stack.indexOf(this.message) + this.message.length; const thisStackTrace = this.stack.slice(indexOfMessage).split('\n').reverse(); const errorStackTrace = error.stack.slice(error.stack.indexOf(error.message!) + error.message!.length).split('\n').reverse();