Package org.sunbird.common.exception
Class MiddlewareException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- java.lang.RuntimeException
-
- org.sunbird.common.exception.MiddlewareException
-
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
ClientException,ResourceNotFoundException,ServerException
public class MiddlewareException extends RuntimeException
Base class for middleware exceptions. Provides the support for returning error code and error message. Each middleware operation should define appropriate error codes to convey the meaning of the exception. This class mandates the error code parameter in all its constructors.- Author:
- Feroz
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description MiddlewareException(String errCode, String message)Initializes the middleware exception with a given error code and message.MiddlewareException(String errCode, String message, Object... params)Initializes the middleware exception with a template messageMiddlewareException(String errCode, String message, Throwable root)Initializes the middleware exception with a template messageMiddlewareException(String errCode, String message, Throwable root, Object... params)Initializes the middleware exception with a template message
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetErrCode()ResponseCodegetResponseCode()StringtoString()-
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace
-
-
-
-
Constructor Detail
-
MiddlewareException
public MiddlewareException(String errCode, String message)
Initializes the middleware exception with a given error code and message.- Parameters:
errCode- Error code from the servicemessage- Error message (static). For parameter substitution use the other constructor
-
MiddlewareException
public MiddlewareException(String errCode, String message, Object... params)
Initializes the middleware exception with a template message- Parameters:
errCode- Error code from the servicemessage- Error message, which conforms to the java.text.MessageFormat specparams- Parameters substituted in the message string
-
MiddlewareException
public MiddlewareException(String errCode, String message, Throwable root)
Initializes the middleware exception with a template message- Parameters:
errCode- Error code from the servicemessage- Error messageroot- Root cause exception
-
MiddlewareException
public MiddlewareException(String errCode, String message, Throwable root, Object... params)
Initializes the middleware exception with a template message- Parameters:
errCode- Error code from the serviceroot- Root cause of the exceptionmessage- Error message, which conforms to the java.text.MessageFormat specparams- Parameters substituted in the message string
-
-
Method Detail
-
getErrCode
public String getErrCode()
- Returns:
- the errCode
-
getResponseCode
public ResponseCode getResponseCode()
-
-