From 582bcfb3a35abf0416f142c0213a98a098504a09 Mon Sep 17 00:00:00 2001 From: Martin Karkowski Date: Mon, 18 Oct 2021 08:02:19 +0200 Subject: [PATCH] Adding fixes to simpler find bugs --- lib/helpers/runtimeMethods.ts | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/lib/helpers/runtimeMethods.ts b/lib/helpers/runtimeMethods.ts index df03876..3dc7005 100644 --- a/lib/helpers/runtimeMethods.ts +++ b/lib/helpers/runtimeMethods.ts @@ -17,15 +17,28 @@ const _runningInNode = ( * Function to call a function something direct async */ export const callImmediate = _runningInNode ? (callback: (...args) => void, ...args) => { + // return setTimeout(callback, 0, ...args); + const trace = new Error("Error for Bugtracing"); return setImmediate(() => { try { callback(...args); } catch (error) { console.error(error); + console.log("Trancing Bug with the Following Error"); + console.error(trace); } }); } : (callback: (...args) => void, ...args) => { - return setTimeout(callback, 0, ...args); + const trace = new Error("Error for Bugtracing"); + return setTimeout(() => { + try { + callback(...args); + } catch (error) { + console.error(error); + console.log("Trancing Bug with the Following Error"); + console.error(trace); + } + }, 0); }; export const callDirect = (callback: (...args) => void, ...args) => {