Skip to content

Commit

Permalink
specs-go: Make ErrorResponse a Go error.
Browse files Browse the repository at this point in the history
Signed-off-by: Atlas Kerr <atlaskerr@gmail.com>
  • Loading branch information
bsatlas committed Jan 31, 2019
1 parent f4ed72f commit 8481696
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions specs-go/v1/error.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,21 @@ package v1

// ErrorResponse is returned by a registry on an invalid request.
type ErrorResponse struct {
Errors []ErrorDetail `json:"errors"`
Errors []ErrorInfo `json:"errors"`
}

// ErrorDetail describes a server error returned from a registry.
type ErrorDetail struct {
// Error implements the Error interface.
func (er *ErrorResponse) Error() string {
return "distribution: registry returned error"
}

// Detail returns an ErrorInfo
func (er *ErrorResponse) Detail() []ErrorInfo {
return er.Errors
}

// ErrorInfo describes a server error returned from a registry.
type ErrorInfo struct {
Code string `json:"code"`
Message string `json:"message"`
Detail string `json:"detail"`
Expand Down

0 comments on commit 8481696

Please sign in to comment.