mirror of
https://github.com/hashicorp/vault.git
synced 2026-05-05 12:26:34 +02:00
backport error changes from ent PR (#12926)
This commit is contained in:
parent
5dc90d8081
commit
5230d79a2f
@ -7,6 +7,10 @@ var (
|
||||
// No operation is expected to succeed before unsealing
|
||||
ErrSealed = errors.New("Vault is sealed")
|
||||
|
||||
// ErrAPILocked is returned if an operation is performed when the API is
|
||||
// locked for the request namespace.
|
||||
ErrAPILocked = errors.New("API access to this namespace has been locked by an administrator")
|
||||
|
||||
// ErrStandby is returned if an operation is performed on a standby Vault.
|
||||
// No operation is expected to succeed until active.
|
||||
ErrStandby = errors.New("Vault is in standby mode")
|
||||
|
||||
@ -51,10 +51,6 @@ var (
|
||||
// Error indicating that the requested path used to serve a purpose in older
|
||||
// versions, but the functionality has now been removed
|
||||
ErrPathFunctionalityRemoved = errors.New("functionality on this path has been removed")
|
||||
|
||||
// ErrorLocked indicates that the requested path is locked. Functionality
|
||||
// will not be restored until it is unlocked.
|
||||
ErrLocked = errors.New("API access to this namespace has been locked by an administrator")
|
||||
)
|
||||
|
||||
type HTTPCodedError interface {
|
||||
|
||||
@ -120,8 +120,6 @@ func RespondErrorCommon(req *Request, resp *Response, err error) (int, error) {
|
||||
statusCode = http.StatusPreconditionFailed
|
||||
case errwrap.Contains(err, ErrPathFunctionalityRemoved.Error()):
|
||||
statusCode = http.StatusNotFound
|
||||
case errwrap.Contains(err, ErrLocked.Error()):
|
||||
statusCode = http.StatusLocked
|
||||
}
|
||||
}
|
||||
|
||||
@ -148,6 +146,10 @@ func AdjustErrorStatusCode(status *int, err error) {
|
||||
*status = http.StatusServiceUnavailable
|
||||
}
|
||||
|
||||
if errwrap.Contains(err, consts.ErrAPILocked.Error()) {
|
||||
*status = http.StatusServiceUnavailable
|
||||
}
|
||||
|
||||
// Adjust status code on
|
||||
if errwrap.Contains(err, "http: request body too large") {
|
||||
*status = http.StatusRequestEntityTooLarge
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user