add not found error as well
This commit is contained in:
@@ -20,9 +20,9 @@ var (
|
|||||||
RunnerExistsError = scalesetError("runner exists")
|
RunnerExistsError = scalesetError("runner exists")
|
||||||
JobStillRunningError = scalesetError("job still running")
|
JobStillRunningError = scalesetError("job still running")
|
||||||
MessageQueueTokenExpiredError = scalesetError("message queue token expired")
|
MessageQueueTokenExpiredError = scalesetError("message queue token expired")
|
||||||
// BadRequest is used when the error is not from the HTTP client, but from the application logic,
|
// Top level errors carying the http status code meanings.
|
||||||
// such as invalid request body, missing required parameters, etc. It indicates that the request was malformed or invalid.
|
|
||||||
BadRequest = scalesetError("bad request")
|
BadRequest = scalesetError("bad request")
|
||||||
|
NotFound = scalesetError("not found")
|
||||||
Unauthorized = scalesetError("unauthorized")
|
Unauthorized = scalesetError("unauthorized")
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -107,6 +107,8 @@ func wrapResponseErrorType(resp *http.Response, err error) error {
|
|||||||
return fmt.Errorf("%w: %w", BadRequest, err)
|
return fmt.Errorf("%w: %w", BadRequest, err)
|
||||||
case http.StatusUnauthorized:
|
case http.StatusUnauthorized:
|
||||||
return fmt.Errorf("%w: %w", Unauthorized, err)
|
return fmt.Errorf("%w: %w", Unauthorized, err)
|
||||||
|
case http.StatusNotFound:
|
||||||
|
return fmt.Errorf("%w: %w", NotFound, err)
|
||||||
default:
|
default:
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user