Skip to content

fix: keep the error message in logs when the stack omits it (#115) - #116

Merged
erseco merged 1 commit into
mainfrom
hotfix/issue-115-firefox-error-message
Oct 19, 2026
Merged

erseco merged 1 commit into
mainfrom
hotfix/issue-115-firefox-error-message

Conversation

@erseco

@erseco erseco commented Oct 19, 2026

Copy link
Copy Markdown
Member

Closes #115

Problem

Firefox and Safari put only the stack frames in Error.prototype.stack; Chromium starts it with Name: message. formatErrorDetail() and the shell/service worker logged String(error?.stack || error?.message || error), so in Firefox/Safari the error name and message were lost.

Solution

  • Move formatErrorDetail() from src/runtime/crash-recovery.js to src/shared/protocol.js (already imported by the worker, shell and service worker).
  • Prepend Name: message when the stack does not already start with it.
  • Use it in php-worker.js, src/shell/main.js (import handler, main() catch) and sw.js (request forwarding errors).

Mirrors ateeducacion/omeka-s-playground#204 (issue ateeducacion/omeka-s-playground#203).

Tests

  • New tests/shared-protocol.test.mjs: red against the old formatter (actual: 'run@http://localhost/dist/php-worker.bundle.js:1:1\n', missing PHPExecutionFailureError: ...), green after the fix.
  • npm test: 234/234 pass. make lint clean. npm run build-worker rebuilt; both bundles contain the new logic.

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
@erseco erseco added the bug Something isn't working label Oct 19, 2026
@erseco erseco self-assigned this Oct 19, 2026
@erseco
erseco merged commit 32a6041 into main Oct 19, 2026
6 checks passed
@erseco
erseco deleted the hotfix/issue-115-firefox-error-message branch October 19, 2026 20:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error name and message are missing from logs in Firefox and Safari

1 participant