go-zero
go-zero copied to clipboard
feat. mapping Optimized error stack
Optimize error returns to allow external parties to better judge errors
I can set an error handler to accurately handle error parameters with a single judgment.
httpx.SetErrorHandler(func(err error) (int, any) {
if errors.Is(err, mapping.ErrMappingErrors) {
return http.StatusBadRequest, nil
}
return http.StatusInternalServerError, nil
})