-
Notifications
You must be signed in to change notification settings - Fork 1
Closed as not planned
Description
Currently we construct an APIError when we get a validation or 404 error from the api, joining all of the error messages before returning them in an APIError { e string ReqID string } that implements the Error interface from go std lib.
It'd be useful in DNClient Desktop to be able to access an APIErrors property or something similar, to be able to go through each individual api error returned, and match on the error code and path when supplying nicer task-specific errors to users.
Simplest might be allowing the APIError struct to contain a list of APIErrors as an extra property.
// - package dnapi
// APIError wraps an error and contains the RequestID from the X-Request-ID
// header of an API response. ReqID defaults to empty string if the header is
// not in the response.
type APIError struct {
e error
ReqID string
+ APIErrors APIErrors
}to contain
// - package message
// APIError represents a single error returned in an API error response.
type APIError struct {
Code string `json:"code"`
Message string `json:"message"`
Path string `json:"path"` // may or may not be present
}Metadata
Metadata
Assignees
Labels
No labels