-
Notifications
You must be signed in to change notification settings - Fork 3
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
api: enhance error reporting with custom error codes and messages #136
Comments
@SirCotare @danielecanu {
"errorCode": 400,
"message": "Request method 'PATCH' not supported",
"stacktrace": ""
} This is misleading I think, we should instead show an unauthorized error code and message. Could you please fix that? With the Bearer token headers the PATCH commands seem to work (tested only with |
@SirCotare It seems that this is somehow the "default" error message... If I send a wrong JSON with a call, it does not show that the payload is wrong but also "PATCH not supported error" |
We will check this with #148 |
I tested this and the PATCH error is no longer wrongly shown, however the error messages are still very noisy... For example: POST /admin/webcomponent/f594de36-0136-4c27-a0e6-570fa7014129
Content-Type: application/json
Authorization: Bearer {{token}} shows {
"errorCode": 400,
"message": "Validation failed for argument [1] in public it.bz.opendatahub.webcomponents.dataservice.application.adapter.in.web.admin.rest.WebcomponentVersionAdminRest it.bz.opendatahub.webcomponents.dataservice.application.adapter.in.web.admin.WebcomponentVersionAdminController.createNewVersion(java.lang.String,it.bz.opendatahub.webcomponents.dataservice.application.port.in.CreateWebcomponentVersionUseCase$WebcomponentVersionCreateRequest): [Field error in object 'webcomponentVersionCreateRequest' on field 'configuration': rejected value [null]; codes [NotNull.webcomponentVersionCreateRequest.configuration,NotNull.configuration,NotNull.it.bz.opendatahub.webcomponents.common.data.struct.Configuration,NotNull]; arguments [org.springframework.context.support.DefaultMessageSourceResolvable: codes [webcomponentVersionCreateRequest.configuration,configuration]; arguments []; default message [configuration]]; default message [must not be null]] ",
"stacktrace": ""
} if a wrong JSON format has been given. Those error messages should not just pass-thru whatever the exception throws, but give a meaningful hint to the API user. |
The nice user-facing error messages needs to be written custom and not just passed through the Bean validation tooling. It is not easy to implement, needs a lot of work, and is not blocking. Therefore, we decided to implement it in a future iteration... To be clear, related bugs are solved |
The text was updated successfully, but these errors were encountered: