Package com.github.ambry.rest
Enum RestServiceErrorCode
- java.lang.Object
-
- java.lang.Enum<RestServiceErrorCode>
-
- com.github.ambry.rest.RestServiceErrorCode
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<RestServiceErrorCode>
public enum RestServiceErrorCode extends java.lang.Enum<RestServiceErrorCode>
All the error codes that accompany aRestServiceException
. Each of these error codes are expected to go into certain "groups" that map to HTTP error codes. The groups are:ResponseStatus.Gone
ResponseStatus.NotFound
ResponseStatus.BadRequest
ResponseStatus.InternalServerError
ResponseStatus.Forbidden
ResponseStatus.ProxyAuthenticationRequired
ResponseStatus.Unauthorized
About logging: Generally, error codes not belonging to the groupInternalServerError
are logged at DEBUG level.
-
-
Enum Constant Summary
Enum Constants Enum Constant Description AccessDenied
An authenticated client is not authorized to access a resource.BadRequest
Generic BadRequest error code when a client provides a request that is not fit for processing.Conflict
Request conflicts with the current state of the server.Deleted
Resource has been deleted or has expired.IdConverterServiceError
Indicates thatIdConverter
encountered some exception during ID conversionInsufficientCapacity
There is insufficient capacity to service the request.InternalServerError
Generic InternalServerError that is a result of problems on the server side that is not caused by the client and there is nothing that a client can do about it.InvalidAccount
The account is not valid.InvalidArgs
Client has sent arguments (whether in the URI or in the headers) that are not in the format that is expected or if the number of values for an argument expected by the server does not match what the client sent.InvalidContainer
The container is not valid.InvalidRequestState
Client has sent request content without sending request metadata first or has sent content when no content was expected (for e.g.MalformedRequest
Client has sent a request that cannot be decoded using the REST protocol (usually HTTP).MissingArgs
Client has sent a request that is missing some arguments (whether in the URI or in the headers) necessary to service the request.NotAllowed
Action not allowedNotFound
Resource was not found.PreconditionFailed
The conditions given in the request header fields evaluated to false.RangeNotSatisfiable
Range request is not satisfiable (because the provided range is invalid or outside of the bounds of an object.)RequestChannelClosed
Indicates that aRestRequest
has been closed and an operation could not be performed on it.RequestResponseQueuingFailure
Indicates that the submitted request or response could not be queued in the AsyncRequestResponseHandler.RequestTooLarge
The request is larger than what the server is willing or is configured to accept.ResourceDirty
Resource scan has deducted that the resource is not safe for servingResourceScanInProgress
Resource scan still in progress and result not yet availableServiceUnavailable
Indicates that the service is unavailable because one or more of the components is not started, is shutdown, has crashed or is temporarily unable to respond.TooManyRequests
Application rate limit exceeded/Application quota limit exceeded.Unauthorized
Client has sent a request that cannot be processed due to authorization failure.UnsupportedHttpMethod
Client is requesting a HTTP method that is not supported.UnsupportedRestMethod
Indicates aRestMethod
is not supported (May also indicate a bug where behaviour for a newRestMethod
has not been defined in the implementation).
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static RestServiceErrorCode
getRestServiceErrorCode(AccountServiceErrorCode accountServiceErrorCode)
Gets the RestServiceErrorCode that corresponds to theaccountServiceErrorCode
.static RestServiceErrorCode
getRestServiceErrorCode(RouterErrorCode routerErrorCode)
Gets the RestServiceErrorCode that corresponds to therouterErrorCode
.static RestServiceErrorCode
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.static RestServiceErrorCode[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
Deleted
public static final RestServiceErrorCode Deleted
Resource has been deleted or has expired.
-
NotFound
public static final RestServiceErrorCode NotFound
Resource was not found.
-
ResourceScanInProgress
public static final RestServiceErrorCode ResourceScanInProgress
Resource scan still in progress and result not yet available
-
ResourceDirty
public static final RestServiceErrorCode ResourceDirty
Resource scan has deducted that the resource is not safe for serving
-
AccessDenied
public static final RestServiceErrorCode AccessDenied
An authenticated client is not authorized to access a resource.
-
Unauthorized
public static final RestServiceErrorCode Unauthorized
Client has sent a request that cannot be processed due to authorization failure.
-
BadRequest
public static final RestServiceErrorCode BadRequest
Generic BadRequest error code when a client provides a request that is not fit for processing.
-
InvalidArgs
public static final RestServiceErrorCode InvalidArgs
Client has sent arguments (whether in the URI or in the headers) that are not in the format that is expected or if the number of values for an argument expected by the server does not match what the client sent.
-
InvalidRequestState
public static final RestServiceErrorCode InvalidRequestState
Client has sent request content without sending request metadata first or has sent content when no content was expected (for e.g. content withRestMethod.GET
).
-
InvalidAccount
public static final RestServiceErrorCode InvalidAccount
The account is not valid.
-
InvalidContainer
public static final RestServiceErrorCode InvalidContainer
The container is not valid.
-
MalformedRequest
public static final RestServiceErrorCode MalformedRequest
Client has sent a request that cannot be decoded using the REST protocol (usually HTTP).
-
MissingArgs
public static final RestServiceErrorCode MissingArgs
Client has sent a request that is missing some arguments (whether in the URI or in the headers) necessary to service the request.
-
UnsupportedHttpMethod
public static final RestServiceErrorCode UnsupportedHttpMethod
Client is requesting a HTTP method that is not supported.
-
RangeNotSatisfiable
public static final RestServiceErrorCode RangeNotSatisfiable
Range request is not satisfiable (because the provided range is invalid or outside of the bounds of an object.)
-
InternalServerError
public static final RestServiceErrorCode InternalServerError
Generic InternalServerError that is a result of problems on the server side that is not caused by the client and there is nothing that a client can do about it.
-
IdConverterServiceError
public static final RestServiceErrorCode IdConverterServiceError
Indicates thatIdConverter
encountered some exception during ID conversion
-
RequestChannelClosed
public static final RestServiceErrorCode RequestChannelClosed
Indicates that aRestRequest
has been closed and an operation could not be performed on it.
-
RequestResponseQueuingFailure
public static final RestServiceErrorCode RequestResponseQueuingFailure
Indicates that the submitted request or response could not be queued in the AsyncRequestResponseHandler.
-
RequestTooLarge
public static final RestServiceErrorCode RequestTooLarge
The request is larger than what the server is willing or is configured to accept.
-
ServiceUnavailable
public static final RestServiceErrorCode ServiceUnavailable
Indicates that the service is unavailable because one or more of the components is not started, is shutdown, has crashed or is temporarily unable to respond.
-
TooManyRequests
public static final RestServiceErrorCode TooManyRequests
Application rate limit exceeded/Application quota limit exceeded.
-
UnsupportedRestMethod
public static final RestServiceErrorCode UnsupportedRestMethod
Indicates aRestMethod
is not supported (May also indicate a bug where behaviour for a newRestMethod
has not been defined in the implementation).
-
InsufficientCapacity
public static final RestServiceErrorCode InsufficientCapacity
There is insufficient capacity to service the request.
-
PreconditionFailed
public static final RestServiceErrorCode PreconditionFailed
The conditions given in the request header fields evaluated to false.
-
NotAllowed
public static final RestServiceErrorCode NotAllowed
Action not allowed
-
Conflict
public static final RestServiceErrorCode Conflict
Request conflicts with the current state of the server.
-
-
Method Detail
-
values
public static RestServiceErrorCode[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (RestServiceErrorCode c : RestServiceErrorCode.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static RestServiceErrorCode valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is null
-
getRestServiceErrorCode
public static RestServiceErrorCode getRestServiceErrorCode(RouterErrorCode routerErrorCode)
Gets the RestServiceErrorCode that corresponds to therouterErrorCode
.- Parameters:
routerErrorCode
- inputRouterErrorCode
.- Returns:
- the RestServiceErrorCode that the
routerErrorCode
belongs to.
-
getRestServiceErrorCode
public static RestServiceErrorCode getRestServiceErrorCode(AccountServiceErrorCode accountServiceErrorCode)
Gets the RestServiceErrorCode that corresponds to theaccountServiceErrorCode
.- Parameters:
accountServiceErrorCode
- inputAccountServiceErrorCode
.- Returns:
- the RestServiceErrorCode that the
accountServiceErrorCode
belongs to.
-
-