From c704fef47a3cc118cdad4fdae2b38e73cba4d82d Mon Sep 17 00:00:00 2001 From: Pooya Parsa Date: Wed, 18 Dec 2024 16:24:36 +0100 Subject: [PATCH] fix: capture stacktrace of thrown errors --- src/drivers/utils/index.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/drivers/utils/index.ts b/src/drivers/utils/index.ts index 0aa3a138..6bba218c 100644 --- a/src/drivers/utils/index.ts +++ b/src/drivers/utils/index.ts @@ -31,6 +31,9 @@ export function createError( opts?: ErrorOptions ) { const err = new Error(`[unstorage] [${driver}] ${message}`, opts); + if (Error.captureStackTrace) { + Error.captureStackTrace(err, createError); + } return err; }