Package com.mongodb.stitch.core
Class StitchServiceException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- java.lang.RuntimeException
-
- com.mongodb.stitch.core.StitchException
-
- com.mongodb.stitch.core.StitchServiceException
-
- All Implemented Interfaces:
Serializable
public final class StitchServiceException extends StitchException
A StitchServiceException is an exception indicating that an error came from the Stitch server after a request was completed, with an error message and an error code defined in the `StitchServiceErrorCode` enum.It is possible that the error code will be `UNKNOWN`, which can mean one of several possibilities: the Stitch server returned a message that this version of the SDK does not yet recognize, the server is not a Stitch server and returned an unexpected message, or the response was corrupted. In these cases, the associated message will be the plain text body of the response, or an empty string if the body is empty or not decodable as plain text.
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description StitchServiceException(StitchServiceErrorCode errorCode)
Constructs a new exception with the given error code.StitchServiceException(String message, StitchServiceErrorCode errorCode)
Constructs a new exception with the given message error code.
-
Method Summary
Modifier and Type Method Description StitchServiceErrorCode
getErrorCode()
Returns theStitchServiceErrorCode
associated with the response to the request.String
toString()
-
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace
-
-
-
-
Constructor Detail
-
StitchServiceException
public StitchServiceException(StitchServiceErrorCode errorCode)
Constructs a new exception with the given error code.- Parameters:
errorCode
- the service error code associated with this exception.
-
StitchServiceException
public StitchServiceException(String message, StitchServiceErrorCode errorCode)
Constructs a new exception with the given message error code.- Parameters:
message
- a message corresponding to the error.errorCode
- the service error code associated with this exception.
-
-
Method Detail
-
getErrorCode
public StitchServiceErrorCode getErrorCode()
Returns theStitchServiceErrorCode
associated with the response to the request.- Returns:
- the
StitchServiceErrorCode
associated with the response to the request.
-
-