Error handling is structured in such a way that typically, a ServiceCodeError is passed through the echo HTTP error, in reference to internally defined errors. We want to be able to obtain and return specific external errors, for example during validation from openapi3. Add a 'details' field to the serviceError struct, to contain extra / externally defined information. Modify HTTPErrorHandler to anticipate either a string or a ServiceErrorCode from echo, and respond accordingly. Edit the affected tests to expect the appropriate response. |
||
|---|---|---|
| .. | ||
| v2 | ||
| server.go | ||