Package com.yahoo.search.result
Class ErrorMessage
java.lang.Object
com.yahoo.processing.request.ErrorMessage
com.yahoo.search.result.ErrorMessage
- All Implemented Interfaces:
Cloneable
public class ErrorMessage
extends com.yahoo.processing.request.ErrorMessage
An error message with a code. Use create methods to create messages.
The identity of an error message is determined by its values.
- Author:
- bratseth
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
static final int
static final int
-
Constructor Summary
ConstructorDescriptionErrorMessage
(int code, String message) ErrorMessage
(int code, String message, String detailedMessage) Creates an application specific error message with an application specific code.ErrorMessage
(int code, String message, String detailedMessage, Throwable cause) Creates an application specific error message with an application specific code and a stack trace. -
Method Summary
Modifier and TypeMethodDescriptionclone()
static ErrorMessage
createBackendCommunicationError
(String detailedMessage) Creates an error indicating that there was a general error communicating with a backend service.static ErrorMessage
createBadRequest
(String detailedMessage) Creates an error analog to HTTP bad request.static ErrorMessage
createDocsumReplyError
(String detailedMessage) Wraps an error message received in a DocsumReply packetstatic ErrorMessage
createEmptyDocsums
(String detailedMessage) Creates an error indicating that a request to a backend returned empty document content data.static ErrorMessage
createErrorInPluginSearcher
(String detailedMessage) Creates a general error from an application components.static ErrorMessage
createErrorInPluginSearcher
(String detailedMessage, Throwable cause) Creates a general error from an application component.static ErrorMessage
createForbidden
(String detailedMessage) Creates an error indicating that a forbidden operation was requested.static ErrorMessage
createIllegalQuery
(String detailedMessage) Creates an error message indicating that an illegal query was attempted evaluated.static ErrorMessage
createInternalServerError
(String detailedMessage) Creates an error analog to HTTP internal server error.static ErrorMessage
createInternalServerError
(String detailedMessage, Throwable cause) Creates an error analog to HTTP internal server error.static ErrorMessage
createInvalidQueryParameter
(String detailedMessage) Creates an error message indicating that an invalid request parameter was received.static ErrorMessage
createInvalidQueryParameter
(String detailedMessage, Throwable cause) Creates an error message indicating that an invalid request parameter was received.static ErrorMessage
createInvalidQueryTransformation
(String detailedMessage) Creates an error indicating that an invalid query transformation was attempted.static ErrorMessage
createNoAnswerWhenPingingNode
(String detailedMessage) Creates an error indicating that a node could not be pinged.static ErrorMessage
createNoBackendsInService
(String detailedMessage) Creates an error message indicating that some backend service is unreachablestatic ErrorMessage
createNotFound
(String detailedMessage) Creates an error indicating that the requested resource was not found.static ErrorMessage
createNullQuery
(String detailedMessage) Creates an error message indicating that a null query was attempted evaluatedstatic ErrorMessage
createRequestTooLarge
(String detailedMessage) Creates an error message indicating that the request is too largestatic ErrorMessage
createSearchReplyError
(String detailedMessage) Wraps an error message received in a SearchReply packetstatic ErrorMessage
createServerIsMisconfigured
(String detailedMessage) Creates an error indicating that the server is misconfiguredstatic ErrorMessage
createTimeout
(String detailedMessage) Creates an error indicating that a request to a backend timed out.static ErrorMessage
createUnauthorized
(String detailedMessage) Creates an error indicating that the requestor is not authorized to perform the requested operation.static ErrorMessage
createUnspecifiedError
(String detailedMessage) Creates a generic message used when there is no information available on the category of the error.static ErrorMessage
createUnspecifiedError
(String detailedMessage, Throwable cause) Creates a generic message used when there is no information available on the category of the error.boolean
static ErrorMessage
from
(com.yahoo.processing.request.ErrorMessage error) Returns the given error message as this type.Returns the source producing this error, or null if no source is specifiedint
hashCode()
void
Sets the source producing this errortoString()
Methods inherited from class com.yahoo.processing.request.ErrorMessage
getCause, getCode, getDetailedMessage, getMessage
-
Field Details
-
NULL_QUERY
public static final int NULL_QUERY -
timeoutCode
public static final int timeoutCode -
emptyDocsumsCode
public static final int emptyDocsumsCode
-
-
Constructor Details
-
ErrorMessage
-
ErrorMessage
Creates an application specific error message with an application specific code. If the error results from an exception a message which includes information from all nested (cause) exceptions can be generated using com.yahoo.protect.Exceptions.toMessageString(exception). -
ErrorMessage
Creates an application specific error message with an application specific code and a stack trace. This should only be used when there is useful information in the cause, i.e when the exception is not expected. Applications rarely need to handle unexpected exceptions as this is done by the framework.
-
-
Method Details
-
createNoBackendsInService
Creates an error message indicating that some backend service is unreachable -
createNullQuery
Creates an error message indicating that a null query was attempted evaluated -
createRequestTooLarge
Creates an error message indicating that the request is too large -
createIllegalQuery
Creates an error message indicating that an illegal query was attempted evaluated. -
createInvalidQueryParameter
Creates an error message indicating that an invalid request parameter was received. -
createInvalidQueryParameter
Creates an error message indicating that an invalid request parameter was received. -
createUnspecifiedError
Creates a generic message used when there is no information available on the category of the error. -
createUnspecifiedError
Creates a generic message used when there is no information available on the category of the error. -
createErrorInPluginSearcher
Creates a general error from an application components. -
createErrorInPluginSearcher
Creates a general error from an application component. -
createInvalidQueryTransformation
Creates an error indicating that an invalid query transformation was attempted. -
createServerIsMisconfigured
Creates an error indicating that the server is misconfigured -
createBackendCommunicationError
Creates an error indicating that there was a general error communicating with a backend service. -
createNoAnswerWhenPingingNode
Creates an error indicating that a node could not be pinged. -
createTimeout
Creates an error indicating that a request to a backend timed out. -
createEmptyDocsums
Creates an error indicating that a request to a backend returned empty document content data. -
createUnauthorized
Creates an error indicating that the requestor is not authorized to perform the requested operation. If this error is present, a HTTP layer will return 401. -
createForbidden
Creates an error indicating that a forbidden operation was requested. If this error is present, a HTTP layer will return 403. -
createNotFound
Creates an error indicating that the requested resource was not found. If this error is present, a HTTP layer will return 404. -
createBadRequest
Creates an error analog to HTTP bad request. If this error is present, a HTTP layer will return 400. -
createInternalServerError
Creates an error analog to HTTP internal server error. If this error is present, a HTTP layer will return 500. -
createInternalServerError
Creates an error analog to HTTP internal server error. If this error is present, a HTTP layer will return 500. -
createSearchReplyError
Wraps an error message received in a SearchReply packet -
createDocsumReplyError
Wraps an error message received in a DocsumReply packet -
setSource
Sets the source producing this error -
getSource
Returns the source producing this error, or null if no source is specified -
hashCode
public int hashCode()- Overrides:
hashCode
in classcom.yahoo.processing.request.ErrorMessage
-
equals
- Overrides:
equals
in classcom.yahoo.processing.request.ErrorMessage
-
toString
- Overrides:
toString
in classcom.yahoo.processing.request.ErrorMessage
-
clone
- Overrides:
clone
in classcom.yahoo.processing.request.ErrorMessage
-
from
Returns the given error message as this type. If it already is, this is a cast of the given instance. Otherwise this creates a new instance having the same payload as the given instance.
-