Package org.xwiki.attachment.validation
Class AttachmentValidationException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- org.xwiki.attachment.validation.AttachmentValidationException
-
- All Implemented Interfaces:
Serializable
@Unstable public class AttachmentValidationException extends Exception
Exception thrown in case of error while validating an attachment. This exception also provides additional accessors to localize the error messages.- Since:
- 14.10
- Version:
- $Id: a40e0108e8db6a498f03f5910e07f2ed641086f4 $
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description AttachmentValidationException(String message, int httpStatus, String translationKey)
Construct a new exception with a message, an http status and a translation key.AttachmentValidationException(String message, int httpStatus, String translationKey, String contextMessage)
Construct a new exception with the specified detail message.AttachmentValidationException(String message, int httpStatus, String translationKey, List<Object> translationParameters, String contextMessage)
Construct a new exception with the specific error message, the http status corresponding to this error, a translation key to localization this error and its parameters.AttachmentValidationException(String message, Throwable cause, int httpStatus, String translationKey)
Contruct a new exception with a message and a cause, plus an http status and a translation key.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getContextMessage()
int
getHttpStatus()
String
getTranslationKey()
List<Object>
getTranslationParameters()
-
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
-
-
-
Constructor Detail
-
AttachmentValidationException
public AttachmentValidationException(String message, int httpStatus, String translationKey, String contextMessage)
Construct a new exception with the specified detail message.- Parameters:
message
- The detailed message. This can later be retrieved by theThrowable.getMessage()
methodhttpStatus
- the http status to return when this exception is caughttranslationKey
- the translation key to use when localizing this errorcontextMessage
- the context message to use for this error
-
AttachmentValidationException
public AttachmentValidationException(String message, int httpStatus, String translationKey, List<Object> translationParameters, String contextMessage)
Construct a new exception with the specific error message, the http status corresponding to this error, a translation key to localization this error and its parameters.- Parameters:
message
- The detailed message. This can later be retrieved by theThrowable.getMessage()
methodhttpStatus
- the http status to return when this exception is caughttranslationKey
- the translation key to use when localizing this errortranslationParameters
- the translation parameters to use when localizing this errorcontextMessage
- the context message to use for this error
-
AttachmentValidationException
public AttachmentValidationException(String message, int httpStatus, String translationKey)
Construct a new exception with a message, an http status and a translation key.- Parameters:
message
- the error messagehttpStatus
- the http statustranslationKey
- the translation key
-
AttachmentValidationException
public AttachmentValidationException(String message, Throwable cause, int httpStatus, String translationKey)
Contruct a new exception with a message and a cause, plus an http status and a translation key.- Parameters:
message
- the error messagecause
- the exception causehttpStatus
- the http statustranslationKey
- the translation key
-
-
Method Detail
-
getHttpStatus
public int getHttpStatus()
- Returns:
- the http status to return when this exception is caught
-
getTranslationKey
public String getTranslationKey()
- Returns:
- the translation key to use when localizing this error
-
getContextMessage
public String getContextMessage()
- Returns:
- the context message to use for this error
-
-