8000 feat: `ProcessOutput.getExitMessage` extracts errors from stdout if s… by antongolub · Pull Request #1166 · google/zx · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

feat: ProcessOutput.getExitMessage extracts errors from stdout if s… #1166

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Mar 31, 2025

Conversation

antongolub
Copy link
Collaborator
@antongolub antongolub commented Mar 30, 2025

relates https://github.com/expr-lang/expr/actions/runs/13945506093/job/39031660474

Before
telegram-cloud-photo-size-5-6257758404311369505-y

After
image

  • Tests pass
  • Appropriate changes to README are included in PR

@antongolub antongolub requested review from Copilot and antonmedv March 30, 2025 14:07
Copilot

This comment was marked as outdated.

@antongolub antongolub requested a review from Copilot March 30, 2025 15:13
Copy link
@Copilot 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

This PR enhances error message extraction by updating the ProcessOutput.getExitMessage logic to extract errors from stdout when necessary and adds tests to verify the new behavior. Key changes include:

  • Adding new tests for command lookup, error message extraction, and a new findErrors function.
  • Extending the signature of formatExitMessage (and its CJS counterpart) with an optional details parameter and updating the error message construction accordingly.
  • Updating ProcessOutput's message getter to account for error and exit message generation using the new logic.

Reviewed Changes

Copilot reviewed 7 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
test/vendor.test.js Adds a test case to assert that an unknown command throws an error.
test/error.test.ts Modifies tests for getCallerLocation and adds tests for findErrors().
test/core.test.js Updates assertions for error messages and tests enhanced ProcessOutput behavior.
src/error.ts Introduces a new details parameter to formatExitMessage and adds findErrors.
src/core.ts Updates ProcessOutput error message getter to use new error extraction logic.
build/core.cjs Mirrors the changes in formatExitMessage and ProcessOutput error handling.
Files not reviewed (1)
  • .size-limit.json: Language not supported
Comments suppressed due to low confidence (2)

src/core.ts:735

  • [nitpick] The property name 'stdall' may be unclear; consider renaming it to a more descriptive name such as 'combinedOutput' for better clarity.
stdall: { get: once(() => bufArrJoin(dto.store.stdall)) }

src/core.ts:738

  • [nitpick] The conditional usage of this.stderr.trim() to determine whether to call findErrors may lead to inconsistent error detail extraction; verify that this behavior aligns with the intended error extraction logic.
ProcessOutput.getExitMessage(dto.code, dto.signal, this.stderr, dto.from, this.stderr.trim() ? '' : findErrors(this.lines()))

@antongolub antongolub merged commit 9fa4d33 into google:main Mar 31, 2025
26 checks passed
@antongolub antongolub deleted the feat-extract-stdout-errs branch March 31, 2025 09:51
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.

1 participant
0