-
Notifications
You must be signed in to change notification settings - Fork 55
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
Handle REST status codes #74
Conversation
a5b2dfa
to
04a55ec
Compare
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.
Thank you @isinyaaa !
I prefer for this PR to consider changing return error codes also for failed conversions like s.converter ...
in api_model_registry_service_service.go
instead of 500 to return 400 for bad request, as discussed.
I'm not sure I understood internal/server/openapi/error.go
modification, per comment below.
The mapping function, can be done in a subsequent PR.
if errors.Is(err, api.ErrBadRequest) { | ||
return Response(400, model.Error{Message: err.Error()}), nil | ||
} | ||
if errors.Is(err, api.ErrNotFound) { | ||
return Response(404, model.Error{Message: err.Error()}), nil | ||
} |
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.
eventually, there can be a mapping function as discussed which for known-errors will return a Response
if mapped or nil, so we can refactor similar code here.
04a55ec
to
b89271c
Compare
Signed-off-by: Isabella do Amaral <idoamara@redhat.com>
Signed-off-by: Isabella do Amaral <idoamara@redhat.com>
b89271c
to
ae57797
Compare
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.
Thank you for incorporating required improvements and changes from #74 (review) @isinyaaa
/approve
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: isinyaaa, tarilabs The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
[pull] main from kubeflow:main
Closes: opendatahub-io/model-registry-bf4-kf#305
Description
This handles REST status codes coming from the server core layer using enums and error unwrapping as introduced in GO 1.13.
How Has This Been Tested?
Tested with httpie and go tests.
Merge criteria: