public enum RestError extends Enum<RestError> implements org.mule.runtime.extension.api.error.ErrorTypeDefinition<RestError>
| Enum Constant and Description |
|---|
BAD_REQUEST |
CLIENT_ERROR |
CONNECTIVITY |
INTERNAL_SERVER_ERROR |
NOT_ACCEPTABLE |
NOT_FOUND |
SERVER_ERROR |
SERVICE_UNAVAILABLE |
TIMEOUT |
TOO_MANY_REQUESTS |
UNAUTHORIZED |
UNSUPPORTED_MEDIA_TYPE |
| Modifier and Type | Method and Description |
|---|---|
static Optional<RestError> |
getErrorByCode(int statusCode)
Returns the
RestError corresponding to a given status code. |
String |
getErrorMessage(org.mule.runtime.http.api.domain.message.request.HttpRequest request)
Returns the custom error message for this
RestError based on the HttpRequest that triggered it. |
static Optional<org.mule.runtime.http.api.HttpConstants.HttpStatus> |
getHttpStatus(RestError error)
Returns an
HttpConstants.HttpStatus corresponding to a given RestError. |
Optional<org.mule.runtime.extension.api.error.ErrorTypeDefinition<? extends Enum<?>>> |
getParent() |
static RestError |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static RestError[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final RestError CONNECTIVITY
public static final RestError CLIENT_ERROR
public static final RestError TIMEOUT
public static final RestError UNAUTHORIZED
public static final RestError NOT_FOUND
public static final RestError TOO_MANY_REQUESTS
public static final RestError BAD_REQUEST
public static final RestError UNSUPPORTED_MEDIA_TYPE
public static final RestError NOT_ACCEPTABLE
public static final RestError SERVER_ERROR
public static final RestError INTERNAL_SERVER_ERROR
public static final RestError SERVICE_UNAVAILABLE
public static RestError[] values()
for (RestError c : RestError.values()) System.out.println(c);
public static RestError valueOf(String name)
name - the name of the enum constant to be returned.IllegalArgumentException - if this enum type has no constant with the specified nameNullPointerException - if the argument is nullpublic Optional<org.mule.runtime.extension.api.error.ErrorTypeDefinition<? extends Enum<?>>> getParent()
getParent in interface org.mule.runtime.extension.api.error.ErrorTypeDefinition<RestError>public static Optional<RestError> getErrorByCode(int statusCode)
RestError corresponding to a given status code. A match is found if there's an RestError with the
same name as the status code's corresponding HttpConstants.HttpStatus.statusCode - the HTTP status code to search forOptional with the error that matches the statusCodepublic static Optional<org.mule.runtime.http.api.HttpConstants.HttpStatus> getHttpStatus(RestError error)
public String getErrorMessage(org.mule.runtime.http.api.domain.message.request.HttpRequest request)
RestError based on the HttpRequest that triggered it.request - the HttpRequest that caused the errorCopyright © 2024. All rights reserved.