Skip to content

Commit

Permalink
chore(cli): improve error output (#6406)
Browse files Browse the repository at this point in the history
Currently when you get compile errors in the CLI (related to parsing or type checking), the error message appears twice:

```
error: Enum "SomeEnum" does not contain value "FOUR"
  --> examples/tests/invalid/enums.test.w:5:21
  |
5 | let four = SomeEnum.FOUR;
  |                     ^^^^ Enum "SomeEnum" does not contain value "FOUR"
```

The repeated message can make errors look longer and doesn't add any information, so this PR removes the second occurrence of the error message.

## Checklist

- [x] Title matches [Winglang's style guide](https://www.winglang.io/contributing/start-here/pull_requests#how-are-pull-request-titles-formatted)
- [x] Description explains motivation and solution
- [x] Tests added (always)
- [ ] Docs updated (only required for features)
- [ ] Added `pr/e2e-full` label if this feature requires end-to-end testing

*By submitting this pull request, I confirm that my contribution is made under the terms of the [Wing Cloud Contribution License](https://github.com/winglang/wing/blob/main/CONTRIBUTION_LICENSE.md)*.
  • Loading branch information
Chriscbr authored May 5, 2024
1 parent bf69e29 commit 8a6ac4d
Show file tree
Hide file tree
Showing 3 changed files with 510 additions and 522 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const formatWingError = async (error: unknown, entryPoint?: string) => {
fileId: filePath,
rangeStart: start,
rangeEnd: end,
message,
message: "",
style: "primary",
});
}
Expand Down
2 changes: 1 addition & 1 deletion apps/wing/src/commands/compile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ export async function compile(entrypoint?: string, options?: CompileOptions): Pr
fileId: filePath,
rangeStart: start,
rangeEnd: end,
message,
message: "",
style: "primary",
});
}
Expand Down
Loading

0 comments on commit 8a6ac4d

Please sign in to comment.