Skip to content

fix(respecDocWriter): show actual error instead of 'Error: undefined'#5179

Open
marcoscaceres wants to merge 4 commits intomainfrom
fix/error-undefined-message
Open

fix(respecDocWriter): show actual error instead of 'Error: undefined'#5179
marcoscaceres wants to merge 4 commits intomainfrom
fix/error-undefined-message

Conversation

@marcoscaceres
Copy link
Copy Markdown
Contributor

The timeout rejection in evaluateHTML rejects with a plain string, not an Error object. When caught, err.stack is undefined, producing 'Error: undefined'. Now falls back to err itself when stack is unavailable.

Closes #5080

The timeout rejection in evaluateHTML rejects with a plain string, not
an Error object. When caught, err.stack is undefined, producing the
unhelpful message 'Error: undefined'. Now falls back to err itself
when stack is unavailable.

Closes #5080
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Improves the fatal error message emitted by respecDocWriter during static HTML generation so that non-Error rejections (e.g., plain strings) show meaningful details instead of Error: undefined.

Changes:

  • Update generateHTML() error formatting to fall back to the caught value when err.stack is unavailable.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@marcoscaceres
Copy link
Copy Markdown
Contributor Author

evaluateHTML rejects with a plain string

@copilot, would it be possible/better to reject evaluateHTML with an actual error somehow? Then we would always have a stack.

…k trace

Agent-Logs-Url: https://github.com/speced/respec/sessions/f176c005-9bb3-483c-8784-2ca3e5ac0dff

Co-authored-by: marcoscaceres <870154+marcoscaceres@users.noreply.github.com>
Copy link
Copy Markdown

Copilot AI commented Apr 13, 2026

evaluateHTML rejects with a plain string

@copilot, would it be possible/better to reject evaluateHTML with an actual error somehow? Then we would always have a stack.

Fixed the root cause in b27310esetTimeout(() => reject(msg), ms) now becomes setTimeout(() => reject(new Error(msg)), ms), so evaluateHTML always rejects with a proper Error object and we always have a stack. The err.stack || err workaround in generateHTML is reverted since it's no longer needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Undefined error during static HTML generation

3 participants