Context
For *requests_total Counter metric we need to track HTTP response status code and operation name inside middleware.
With convenient_errors: true (or "on") is enabled, ogen provides convenient way to map errors to status codes, however the problem is that these status-code-aware errors do not seem to be returned to the middleware chain .
Current Behavior
...
resp, err := next(req)
...
err = errors.New("not found")
nothing can be done here.
Expected
...
resp, err := next(req)
...
err = ConvenientErrorWithStatusCode{
StatusCode: 404,
...
}
using errors.As it's possible to extract status code from the error.
Context
For
*requests_totalCounter metric we need to track HTTP response status code and operation name inside middleware.With
convenient_errors: true(or"on") is enabled, ogen provides convenient way to map errors to status codes, however the problem is that these status-code-aware errors do not seem to be returned to the middleware chain .Current Behavior
nothing can be done here.
Expected
using
errors.Asit's possible to extract status code from the error.