refactor: switch to OpenAPITools's generator for our HTTP clients (#33)
* build: add CI job to check OpenAPI generation is clean * feat: add hidden flag for HTTP debug
This commit is contained in:
22
internal/api/error.go
Normal file
22
internal/api/error.go
Normal file
@ -0,0 +1,22 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// Extension to let our API error type be used as a "standard" error.
|
||||
func (o *Error) Error() string {
|
||||
if o.Message != "" && o.Err != nil {
|
||||
var b strings.Builder
|
||||
b.WriteString(o.Message)
|
||||
b.WriteString(": ")
|
||||
b.WriteString(*o.Err)
|
||||
return b.String()
|
||||
} else if o.Message != "" {
|
||||
return o.Message
|
||||
} else if o.Err != nil {
|
||||
return *o.Err
|
||||
}
|
||||
return fmt.Sprintf("<%s>", o.Code)
|
||||
}
|
||||
Reference in New Issue
Block a user