-
Notifications
You must be signed in to change notification settings - Fork 47
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
Better errormessage #266
base: main
Are you sure you want to change the base?
Better errormessage #266
Conversation
pkg/utils/error.go
Outdated
func ErrorStatusCode(err error) int64 { | ||
re := regexp.MustCompile(`\[(\d{3})\]`) | ||
matches := re.FindStringSubmatch(err.Error()) | ||
var statusCode int64 | ||
|
||
if len(matches) > 1 { | ||
stringCode := matches[1] | ||
statusCode, _ = strconv.ParseInt(stringCode, 10, 64) | ||
} | ||
return statusCode | ||
} |
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.
implement a better way to get the status code. since regex can fail in different scenarios.
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.
I think we only have the option to extract the status code from the error message.
ea04245
to
cb5437e
Compare
Signed-off-by: ALTHAF <[email protected]>
Signed-off-by: ALTHAF <[email protected]>
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.
LGTM
changed error messages for registry