-
Notifications
You must be signed in to change notification settings - Fork 14
Add unique(ish) ID to error messages for easier Rollbar cross-referencing. #3640
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
Conversation
5402b44 to
bb4d163
Compare
| errorMsg := err.Error() | ||
| if IsReportableError(err) { | ||
| multilog.Critical("Returning error:\n%s\nCreated at:\n%s", errs.JoinMessage(err), stack) | ||
| multilog.Critical("Returning error (ID: %s):\n%s\nCreated at:\n%s", getErrorId(), errs.JoinMessage(err), stack) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will call rollbar.Critical, which forwards our message and error ID to rollbar:
cli/internal/multilog/multilog.go
Line 25 in bb4d163
| rollbar.Critical(format, args...) |
|
|
||
| // Returns a relatively unique ID for error reporting. | ||
| // We report this ID in non-user-facing errors and on Rollbar so we can cross-reference them. | ||
| // Repeated calls return the same ID. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is fine because there can only ever be one error we report to the user that we'd have to lookup on Rollbar.
|
|
||
| var errorId string | ||
|
|
||
| // Returns a relatively unique ID for error reporting. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need a totally unique ID, just something to search for in Rollbar to find the user's log.
Sample:
Note the last line of output.