Package com.google.api.server.spi
Class ServiceException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- com.google.api.server.spi.ServiceException
-
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
BadRequestException,ConflictException,ForbiddenException,InternalServerErrorException,NotFoundException,ServiceUnavailableException,UnauthorizedException
public class ServiceException extends Exception
Generic service exception that, in addition to a status message, has a status code, and optionally, response headers to return.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ServiceException(int statusCode, String statusMessage)ServiceException(int statusCode, String statusMessage, String reason)ServiceException(int statusCode, String statusMessage, String reason, String domain)ServiceException(int statusCode, String statusMessage, String reason, String domain, Throwable cause)ServiceException(int statusCode, String statusMessage, String reason, Throwable cause)ServiceException(int statusCode, String statusMessage, Throwable cause)ServiceException(int statusCode, Throwable cause)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetDomain()Map<String,String>getHeaders()LevelgetLogLevel()StringgetReason()intgetStatusCode()static <T extends ServiceException>
TwithLogLevel(T exception, Level level)-
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
-
-
-
Constructor Detail
-
ServiceException
public ServiceException(int statusCode, String statusMessage)
-
ServiceException
public ServiceException(int statusCode, Throwable cause)
-
ServiceException
public ServiceException(int statusCode, String statusMessage, String reason, Throwable cause)
-
ServiceException
public ServiceException(int statusCode, String statusMessage, String reason, String domain)
-
-
Method Detail
-
getStatusCode
public int getStatusCode()
-
getReason
public String getReason()
-
getDomain
public String getDomain()
-
getLogLevel
public Level getLogLevel()
-
withLogLevel
public static <T extends ServiceException> T withLogLevel(T exception, Level level)
-
-