From f5dd4ac79491d3ea2be9d0c2b06dc565b0ec8fd4 Mon Sep 17 00:00:00 2001 From: Mayukha Vadari Date: Fri, 24 Sep 2021 15:18:48 -0400 Subject: [PATCH] fix: resolve browser issue with Error.captureStackTrace (#1663) * fix webpacking error issue * fix eslint comment --- src/errors.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/errors.ts b/src/errors.ts index 349ed241..6bbda5c8 100644 --- a/src/errors.ts +++ b/src/errors.ts @@ -20,7 +20,10 @@ class XrplError extends Error { this.name = this.constructor.name this.message = message this.data = data - Error.captureStackTrace(this, this.constructor) + // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- `captureStackTrace` can be null in browsers + if (Error.captureStackTrace != null) { + Error.captureStackTrace(this, this.constructor) + } } /**