Skip to content

fix(cli): report command failures in text and JSON modes - #522

Merged
Pavel Feldman (pavelfeldman) merged 2 commits into
mainfrom
triage/502/42092304640-1
Nov 5, 2026
Merged

Pavel Feldman (pavelfeldman) merged 2 commits into
mainfrom
triage/502/42092304640-1

Conversation

@microsoft-playwright-automation

@microsoft-playwright-automation microsoft-playwright-automation Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • The entry point discarded the promise from program(), so argument parsing, startup and daemon validation failures surfaced as unhandled rejections with a stack trace, and --json produced no output.
  • Await the program and report a failure as the message on stderr, or { "isError": true, "error": "..." } on stdout in JSON mode, with exit code 1. The output mode comes from the arguments parsed with the core's parseArgs() (chore: roll Playwright to 1.66.0-alpha-1793916328000 #523), read before program() runs; when parsing itself fails, it falls back to the --json flag.
  • Extend the open-data-URL test with the text and JSON parse error and a daemon-side validation error in JSON mode, and document the behavior.

Fixes #502

The entry point discarded the promise from program(), so argument
parsing, startup and daemon validation failures surfaced as unhandled
rejections with a stack trace, and `--json` produced no output. Report
them as a message on stderr, or `{ isError: true, error }` on stdout in
JSON mode, with exit code 1. The output mode comes from the parsed
arguments, or from the `--json` flag when parsing itself fails.

Fixes: #502
@pavelfeldman Pavel Feldman (pavelfeldman) changed the title fix(cli): handle command failures in text and JSON modes fix(cli): report command failures in text and JSON modes Nov 5, 2026
@pavelfeldman
Pavel Feldman (pavelfeldman) merged commit 34a4860 into main Nov 5, 2026
6 of 7 checks passed
@pavelfeldman
Pavel Feldman (pavelfeldman) deleted the triage/502/42092304640-1 branch November 5, 2026 23:09
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.

@playwright/cli crashes with a raw Node stack trace on any input error (and prints no JSON with --json)

1 participant