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

Update error reporting analytics #2489

Merged
merged 4 commits into from
Apr 14, 2023
Merged

Update error reporting analytics #2489

merged 4 commits into from
Apr 14, 2023

Conversation

MDrakos
Copy link
Member

@MDrakos MDrakos commented Apr 13, 2023

TaskDX-495 As a tech-lead I can diagnose the failure reasons of commands

@github-actions github-actions bot changed the base branch from master to version/0-39-0-RC1 April 13, 2023 21:02
@MDrakos MDrakos marked this pull request as ready for review April 13, 2023 21:39
@MDrakos MDrakos requested a review from Naatan April 13, 2023 21:40
pkg/cmdlets/errors/errors.go Outdated Show resolved Hide resolved
}

logging.Debug("Reporting error:\n%s\nCreated at:\n%s", errs.Join(err, "\n").Error(), stack)
an.EventWithLabel(anaConst.CatDebug, action, strings.Join(label, " "), &dimensions.Values{
Error: p.StrP(err.Error()),
Copy link
Member

Choose a reason for hiding this comment

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

If action == anaConst.ActCommandInputError this needs to be the topmost input error, rather than the topmost error (the two may not be the same).

@MDrakos MDrakos requested a review from Naatan April 14, 2023 22:06
Comment on lines 155 to 161
for err != nil {
if locale.IsInputErrorNonRecursive(err) {
errorMsg = locale.ErrorMessage(err)
break
}
err = errors.Unwrap(err)
}
Copy link
Member

Choose a reason for hiding this comment

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

You forgot to update errorMsg.

Also, you can probably simplify this by using the first slice entry returned by locale.UnwrapError().

Copy link
Member Author

Choose a reason for hiding this comment

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

Do we want to update the error to a special static message if we exit the for loop without encountering an input error? errorMsg is set on line 149 and updated when we encounter the input error.

The first entry in locale.UnwrapError() is not guaranteed to be an input error, just a localized one.

Copy link
Member

Choose a reason for hiding this comment

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

Ah I forgot about that distinction!

Looking at it again, I think your logic is sound! Makes sense to use the non-input error if we didn't encounter one (which shouldn't happen if the input error functions work as intended).

@MDrakos MDrakos requested a review from Naatan April 14, 2023 22:21
Comment on lines 155 to 161
for err != nil {
if locale.IsInputErrorNonRecursive(err) {
errorMsg = locale.ErrorMessage(err)
break
}
err = errors.Unwrap(err)
}
Copy link
Member

Choose a reason for hiding this comment

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

Ah I forgot about that distinction!

Looking at it again, I think your logic is sound! Makes sense to use the non-input error if we didn't encounter one (which shouldn't happen if the input error functions work as intended).

@MDrakos MDrakos merged commit fda0977 into version/0-39-0-RC1 Apr 14, 2023
@MDrakos MDrakos deleted the DX-495 branch April 14, 2023 22:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants