feat: ProcessOutput.getExitMessage extracts errors from stdout if s…#1166
Merged
antongolub merged 5 commits intogoogle:mainfrom Mar 31, 2025
Merged
feat: ProcessOutput.getExitMessage extracts errors from stdout if s…#1166antongolub merged 5 commits intogoogle:mainfrom
ProcessOutput.getExitMessage extracts errors from stdout if s…#1166antongolub merged 5 commits intogoogle:mainfrom
Conversation
There was a problem hiding this comment.
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()))
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.
relates https://github.com/expr-lang/expr/actions/runs/13945506093/job/39031660474
Before

After
