Package com.mongodb.stitch.core
Class StitchRequestException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- java.lang.RuntimeException
-
- com.mongodb.stitch.core.StitchException
-
- com.mongodb.stitch.core.StitchRequestException
-
- All Implemented Interfaces:
Serializable
public class StitchRequestException extends StitchException
Indicates that an error occurred while a request was being carried out. This could be due to (but is not limited to) an unreachable server, a connection timeout, or an inability to decode the result. An error code is included, which indicates whether the error was a transport error or decoding error. The inherited getCause() method from theException
class can be used to produce that underlying error that caused a StitchRequestException. In the case of transport errors, these exception are thrown by the underlyingTransport
of the Stitch client. An error in decoding the result from the server is typically aIOException
thrown internally by the Stitch SDK.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description StitchRequestException(Exception underlyingException, StitchRequestErrorCode errorCode)
Constructs a request exception from the underlying exception and error code.StitchRequestException(String message, StitchRequestErrorCode errorCode)
Constructs a request exception from an error code without an underlying exception.
-
Method Summary
Modifier and Type Method Description StitchRequestErrorCode
getErrorCode()
Returns theStitchRequestErrorCode
indicating the reason for this exception.String
toString()
-
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace
-
-
-
-
Constructor Detail
-
StitchRequestException
public StitchRequestException(String message, StitchRequestErrorCode errorCode)
Constructs a request exception from an error code without an underlying exception.- Parameters:
message
- a message describing the specific exception.errorCode
- the request error code associated with this exception.
-
StitchRequestException
public StitchRequestException(Exception underlyingException, StitchRequestErrorCode errorCode)
Constructs a request exception from the underlying exception and error code.- Parameters:
underlyingException
- the underlying exception that caused this exception.errorCode
- the request error code associated with this exception.
-
-
Method Detail
-
getErrorCode
public StitchRequestErrorCode getErrorCode()
Returns theStitchRequestErrorCode
indicating the reason for this exception.- Returns:
- the
StitchRequestErrorCode
indicating the reason for this exception.
-
-