-
-
Notifications
You must be signed in to change notification settings - Fork 482
Closed
Description
Implement https://pkg.go.dev/errors#Unwrap on internal errors like openapi3filter.RequestError and openap3.SchemaError so we can use errors.Is/errors.As to inspect them
My specific use case is that I have a *openapi3filter.RequestError where the Err property is a *openapi3.SchemaError, and I want to call JSONPointer() on it to get the path where the error occurred. Right now that looks like this:
var e *openapi3filter.RequestError
if goerrors.As(err, &e) {
var e2 *openapi3.SchemaError
if goerrors.As(e.Err, &e2) {
path := e2.JSONPointer()
fmt.Println(path)
}
}
It could look like this:
var e *openapi3.SchemaError
if goerrors.As(err, &e) {
path := e.JSONPointer()
fmt.Println(path)
}
Metadata
Metadata
Assignees
Labels
No labels