Repository navigation
fix: keep the error message in logs when the stack omits it (#115) - #116
Merged
Merged
Conversation
Firefox and Safari list only stack frames in Error.prototype.stack, so logging error.stack dropped the error name and message. formatErrorDetail() now lives in src/shared/protocol.js, prepends "Name: message" when the stack lacks it, and is used by the worker, the shell and the service worker. Closes #115
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #115
Problem
Firefox and Safari put only the stack frames in
Error.prototype.stack; Chromium starts it withName: message.formatErrorDetail()and the shell/service worker loggedString(error?.stack || error?.message || error), so in Firefox/Safari the error name and message were lost.Solution
formatErrorDetail()fromsrc/runtime/crash-recovery.jstosrc/shared/protocol.js(already imported by the worker, shell and service worker).Name: messagewhen the stack does not already start with it.php-worker.js,src/shell/main.js(import handler,main()catch) andsw.js(request forwarding errors).Mirrors ateeducacion/omeka-s-playground#204 (issue ateeducacion/omeka-s-playground#203).
Tests
tests/shared-protocol.test.mjs: red against the old formatter (actual: 'run@http://localhost/dist/php-worker.bundle.js:1:1\n', missingPHPExecutionFailureError: ...), green after the fix.npm test: 234/234 pass.make lintclean.npm run build-workerrebuilt; both bundles contain the new logic.