Package io.jenkins.blueocean.commons
Class ServiceException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- java.lang.RuntimeException
-
- io.jenkins.blueocean.commons.ServiceException
-
- All Implemented Interfaces:
Serializable
,org.kohsuke.stapler.HttpResponse
- Direct Known Subclasses:
ServiceException.BadRequestException
,ServiceException.ConflictException
,ServiceException.ForbiddenException
,ServiceException.MethodNotAllowedException
,ServiceException.NotFoundException
,ServiceException.NotImplementedException
,ServiceException.PreconditionRequired
,ServiceException.TooManyRequestsException
,ServiceException.UnauthorizedException
,ServiceException.UnexpectedErrorException
,ServiceException.UnprocessableEntityException
,ServiceException.UnsupportedMediaTypeException
public class ServiceException extends RuntimeException implements org.kohsuke.stapler.HttpResponse
This exception class to be used by all service methods. An error is represented by a code, in case of HTTP transport it could be http specific error code. Error message is represented byErrorMessage
- Author:
- Vivek Pandey
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ServiceException.BadRequestException
static class
ServiceException.ConflictException
static class
ServiceException.ForbiddenException
static class
ServiceException.MethodNotAllowedException
static class
ServiceException.NotFoundException
Convenience exception classes modeled after HTTP exceptionsstatic class
ServiceException.NotImplementedException
static class
ServiceException.PreconditionRequired
static class
ServiceException.TooManyRequestsException
static class
ServiceException.UnauthorizedException
static class
ServiceException.UnexpectedErrorException
static class
ServiceException.UnprocessableEntityException
static class
ServiceException.UnsupportedMediaTypeException
-
Field Summary
Fields Modifier and Type Field Description static int
BAD_REQUEST
static int
CONFLICT
ErrorMessage
errorMessage
static int
FORBIDDEN
static int
INTERNAL_SERVER_ERROR
static int
METHOD_NOT_ALLOWED
static int
NOT_FOUND
static int
NOT_IMPLEMENTED
static int
PRECONDITION_REQUIRED
int
status
static int
TOO_MANY_REQUESTS
static int
UNAUTHORIZED
static int
UNPROCESSABLE_ENTITY
static int
UNSUPPORTED_MEDIA_TYPE
-
Constructor Summary
Constructors Constructor Description ServiceException(int status, ErrorMessage errorMessage, Throwable cause)
ServiceException(int status, String message)
ServiceException(int status, String message, Throwable cause)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
generateResponse(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp, Object node)
String
toJson()
-
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
-
-
-
Field Detail
-
status
public final int status
-
errorMessage
public final ErrorMessage errorMessage
-
BAD_REQUEST
public static final int BAD_REQUEST
- See Also:
- Constant Field Values
-
UNAUTHORIZED
public static final int UNAUTHORIZED
- See Also:
- Constant Field Values
-
FORBIDDEN
public static final int FORBIDDEN
- See Also:
- Constant Field Values
-
NOT_FOUND
public static final int NOT_FOUND
- See Also:
- Constant Field Values
-
METHOD_NOT_ALLOWED
public static final int METHOD_NOT_ALLOWED
- See Also:
- Constant Field Values
-
UNSUPPORTED_MEDIA_TYPE
public static final int UNSUPPORTED_MEDIA_TYPE
- See Also:
- Constant Field Values
-
CONFLICT
public static final int CONFLICT
- See Also:
- Constant Field Values
-
UNPROCESSABLE_ENTITY
public static final int UNPROCESSABLE_ENTITY
- See Also:
- Constant Field Values
-
PRECONDITION_REQUIRED
public static final int PRECONDITION_REQUIRED
- See Also:
- Constant Field Values
-
TOO_MANY_REQUESTS
public static final int TOO_MANY_REQUESTS
- See Also:
- Constant Field Values
-
INTERNAL_SERVER_ERROR
public static final int INTERNAL_SERVER_ERROR
- See Also:
- Constant Field Values
-
NOT_IMPLEMENTED
public static final int NOT_IMPLEMENTED
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ServiceException
public ServiceException(int status, String message)
-
ServiceException
public ServiceException(int status, ErrorMessage errorMessage, Throwable cause)
-
-
Method Detail
-
toJson
public String toJson()
-
generateResponse
public void generateResponse(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp, Object node) throws IOException, javax.servlet.ServletException
- Specified by:
generateResponse
in interfaceorg.kohsuke.stapler.HttpResponse
- Throws:
IOException
javax.servlet.ServletException
-
-