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

Better errormessage #266

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Better errormessage #266

wants to merge 3 commits into from

Conversation

Althaf66
Copy link
Collaborator

changed error messages for registry

pkg/errors/registry_error.go Outdated Show resolved Hide resolved
Comment on lines 8 to 18
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
}
Copy link
Member

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.

Copy link
Collaborator Author

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.

@Vad1mo Vad1mo added the help wanted Extra attention is needed label Dec 3, 2024
@Althaf66 Althaf66 closed this Dec 7, 2024
@Althaf66 Althaf66 reopened this Dec 7, 2024
Signed-off-by: ALTHAF <[email protected]>
Copy link
Member

@Vad1mo Vad1mo left a comment

Choose a reason for hiding this comment

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

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants