[REQ] [rust-server] Log ApiError instead of discarding it
Created by: N-Schaef
Is your feature request related to a problem? Please describe.
As far as I understood swagger::ApiError
from its description, it should be returned for non-user interfacing errors.
When it is returned from the API, an internal server error is displayed to the user automatically, which I think works as intended.
But I also expected the error to be logged for the developer/administrator to investigate the problem.
Describe the solution you'd like
I think it would be good to log the error. In my local fork, I've changed
to
Err(e) => {
// Application code returned an error. This should not happen, as the implementation should
// return a valid response.
error!("{}",e);
*response.status_mut() = StatusCode::INTERNAL_SERVER_ERROR;
and of course added a import for log::error.
Is this in line with the expectations of the maintainers, and should I open a PR with the changes?
Or is it working as intended and ApiError
should be discarded?
Then I'd explain that somewhere or document this behavior.