Port over API bits from #962 (#965)

This commit is contained in:
Jeff Mitchell authored and GitHub committed 2021-02-25 12:39:51 -05:00
1 parent 3ab8bb03de
commit ea23737258
18 files changed
+101 -407

No files matched your search

+6 -1
View File
@@ -32,5 +32,10 @@ func (e *Error) Error() string {
// Errors are considered the same iff they are both api.Errors and their statuses are the same.
func (e *Error) Is(target error) bool {
tApiErr := AsServerError(target)
return tApiErr != nil && tApiErr.Kind == e.Kind && e.ResponseStatus() == tApiErr.ResponseStatus()
return tApiErr != nil && tApiErr.Kind == e.Kind && e.Response().StatusCode() == tApiErr.Response().StatusCode()
}
// Response returns the API response associated with the error
func (e *Error) Response() *Response {
return e.response
}