Skip to content
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

Rework invocation error card and render more types of errors #6407

Merged
merged 2 commits into from
Apr 19, 2024

Conversation

bduffany
Copy link
Member

@bduffany bduffany commented Apr 18, 2024

  • Structure errors as a list rather than trying to pick out a single error from the build
  • Support rendering more types of errors
  • Fetch failed action stdout (not just stderr) - e.g. TypeScript actions put their errors on stdout. So now we show typecheck errors directly in this card

Before:
image

After:
image


Before:
image

After:
image

Related issues: Fixes #6404


componentDidUpdate(prevProps: Props): void {
const model = this.getModel(this.props);
if (!modelsEqual(this.getModel(this.props), this.getModel(prevProps))) {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if (!modelsEqual(this.getModel(this.props), this.getModel(prevProps))) {
if (!modelsEqual(model, this.getModel(prevProps))) {

Copy link
Member Author

Choose a reason for hiding this comment

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

Good catch, done

prettyPrintedStdErr() {
if (!this.state.stdErr) {
return "";
getModel(props = this.props): CardModel {
Copy link
Member

Choose a reason for hiding this comment

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

small nit, i feel like defaulting is kinda error-prone here, and given that you only use it this way in componentDidMount, you might as well make this a standalone function

Copy link
Member Author

Choose a reason for hiding this comment

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

good call, done

// If there was a failed action with a non-zero exit code, use that as the title.
for (const error of model.errors) {
if ((error.action?.exitCode ?? 0) !== 0) {
return `${this.props.model.failedAction?.action?.type} action failed with exit code ${this.props.model.failedAction?.action?.exitCode}`;
Copy link
Member

Choose a reason for hiding this comment

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

any better value to put here for type ? i guess this is fine, it just drives me nuts that nullishness isn't explicitly linked between the two.

Copy link
Member Author

Choose a reason for hiding this comment

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

made it default to "Build" so it'll render as "Build action" if it's missing 🤡

// If the finished event exists and there's a non-zero exit code, use that as the card title.
for (const error of model.errors) {
if ((error.finished?.exitCode ?? 0) !== 0) {
return exitCode(error.finished?.exitCode?.name ?? "");
Copy link
Member

Choose a reason for hiding this comment

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

i think all of the wildcards on the return here are not needed and name is defined, right?

Copy link
Member Author

Choose a reason for hiding this comment

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

I tried this originally but I think the compiler isn't smart enough to narrow the type in this case - it doesn't seem to draw the connection between the ?? 0 and the !== 0

@bduffany bduffany merged commit 28d8f2e into master Apr 19, 2024
18 of 19 checks passed
@bduffany bduffany deleted the error-card-rework branch April 19, 2024 13:00
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.

Show analysis phase errors explicitly
2 participants