diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2024-01-01 13:48:29 -0400 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2024-01-01 20:06:24 -0400 |
commit | 1fdbc0d9fde7205a04ee98f064bdc8f12867b788 (patch) | |
tree | 1432b4203a7006d70f354cd131a464724ae1b31b | |
parent | 2ab124884fa3d0f9c74dd52e3e823d08b4b01a6d (diff) |
infra: log as content functions errors fixed, even before ready
-rw-r--r-- | src/content/dependencies/index.js | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/content/dependencies/index.js b/src/content/dependencies/index.js index 95247e9c..28755f7b 100644 --- a/src/content/dependencies/index.js +++ b/src/content/dependencies/index.js @@ -35,6 +35,7 @@ export function watchContentDependencies({ const contentDependencies = {}; let emittedReady = false; + let emittedErrorForFunctions = new Set(); let closed = false; let _close = () => {}; @@ -201,7 +202,8 @@ export function watchContentDependencies({ break main; } - if (logging && emittedReady) { + const emittedError = emittedErrorForFunctions.has(functionName); + if (logging && (emittedReady || emittedError)) { const timestamp = new Date().toLocaleString('en-US', {timeStyle: 'medium'}); console.log(colors.green(`[${timestamp}] Updated ${functionName}`)); } @@ -221,6 +223,7 @@ export function watchContentDependencies({ } events.emit('error', functionName, error); + emittedErrorForFunctions.add(functionName); if (logging) { if (contentDependencies[functionName]) { |