You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor: migrate error to a method parameter, not part of ErrorHandlerOpts
While writing the documentation for this, it didn't feel quite right to
note that the `error` wasn't part of the method signature, despite it
being very important for the actual handling of errors.
// ErrorHandlerWithOpts is called when there is an error in validation, with more information about the `error` that occurred and which request is currently being processed.
32
32
//
33
+
// There are a number of known types that the `error` can be:
34
+
//
35
+
// - `*openapi3filter.SecurityRequirementsError` - if the `AuthenticationFunc` has failed to authenticate the request
36
+
// - `*openapi3filter.RequestError` - if a bad request has been made
37
+
//
38
+
// Additionally, if you have set `openapi3filter.Options#MultiError`:
// If both an `ErrorHandlerWithOpts` and `ErrorHandler` are set, the `ErrorHandlerWithOpts` takes precedence.
34
43
//
35
44
// NOTE that this should ideally be used instead of ErrorHandler
36
-
typeErrorHandlerWithOptsfunc(ctx context.Context, w http.ResponseWriter, r*http.Request, optsErrorHandlerOpts)
45
+
typeErrorHandlerWithOptsfunc(ctx context.Context, errerror, w http.ResponseWriter, r*http.Request, optsErrorHandlerOpts)
37
46
38
47
// ErrorHandlerOpts contains additional options that are passed to the `ErrorHandlerWithOpts` function in the case of an error being returned by the middleware
39
48
typeErrorHandlerOptsstruct {
40
-
// Error is the underlying error that triggered this error handler to be executed.
41
-
//
42
-
// Known error types:
43
-
//
44
-
// - `*openapi3filter.SecurityRequirementsError` - if the `AuthenticationFunc` has failed to authenticate the request
45
-
// - `*openapi3filter.RequestError` - if a bad request has been made
46
-
//
47
-
// Additionally, if you have set `openapi3filter.Options#MultiError`:
0 commit comments