Add ability to pass in substitution args into an Error

Signed-off-by: Doug Davis <dug@us.ibm.com>
This commit is contained in:
Doug Davis 2015-06-17 17:39:27 -07:00
parent 2451dd1c32
commit 94e2e9f4a0
5 changed files with 111 additions and 40 deletions

View file

@ -52,10 +52,14 @@ func handleErrorResponse(resp *http.Response) error {
if resp.StatusCode == 401 {
err := parseHTTPErrorResponse(resp.Body)
if uErr, ok := err.(*UnexpectedHTTPResponseError); ok {
return &errcode.Error{
Code: v2.ErrorCodeUnauthorized,
Detail: uErr.Response,
}
return v2.ErrorCodeUnauthorized.WithDetail(uErr.Response)
/*
return &errcode.Error{
Code: v2.ErrorCodeUnauthorized,
Message: v2.ErrorCodeUnauthorized.Message(),
Detail: uErr.Response,
}
*/
}
return err
}