From cfca4cc1ddd251c2d01aaa60ca0968ffd305a3ab Mon Sep 17 00:00:00 2001 From: CanadaHonk Date: Sun, 8 Jan 2023 21:25:34 +0000 Subject: [PATCH] launcher: best eval error handling --- src/launcher/inject.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/launcher/inject.js b/src/launcher/inject.js index 43fbafe..13b1edc 100644 --- a/src/launcher/inject.js +++ b/src/launcher/inject.js @@ -58,7 +58,7 @@ export default async (CDP, proc, injectionType = 'browser', { browserName, openi expression: typeof func === 'string' ? func : `(${func.toString()})()` }, sessionId); - if (reply.exceptionDetails) return new Error(reply.result?.description ?? reply.exceptionDetails.text); + if (reply.exceptionDetails) return new (global[reply.result?.className] ?? Error)((reply.result?.description?.split(':').slice(1).join(':').trim() ?? reply.exceptionDetails.text) + '\n'); return reply.result?.value ?? reply; };