Package com.fauna.exception
Class ProtocolException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- java.lang.RuntimeException
-
- com.fauna.exception.FaunaException
-
- com.fauna.exception.ProtocolException
-
- All Implemented Interfaces:
java.io.Serializable
public class ProtocolException extends FaunaException
Exception representing protocol-level errors in communication with Fauna.This exception is typically thrown when there is an unexpected shape is received on response.. Extends
FaunaExceptionto provide details specific to protocol errors.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ProtocolException(int statusCode, QueryFailure failure)Constructs aProtocolExceptionwith the specified HTTP status code andQueryFailuredetails.ProtocolException(int statusCode, java.lang.String body)Constructs aProtocolExceptionwith the specified HTTP status code and response body.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetBody()Retrieves the response body associated with this protocol error, if available.java.util.Optional<QueryFailure>getQueryFailure()Retrieves theQueryFailuredetails associated with this protocol error, if available.intgetStatusCode()Retrieves the HTTP status code associated with this protocol error.
-
-
-
Constructor Detail
-
ProtocolException
public ProtocolException(int statusCode, QueryFailure failure)Constructs aProtocolExceptionwith the specified HTTP status code andQueryFailuredetails.- Parameters:
statusCode- The HTTP status code received.failure- TheQueryFailureobject containing details about the protocol failure.
-
ProtocolException
public ProtocolException(int statusCode, java.lang.String body)Constructs aProtocolExceptionwith the specified HTTP status code and response body.- Parameters:
statusCode- The HTTP status code received.body- AStringcontaining the response body associated with the failure.
-
-
Method Detail
-
getStatusCode
public int getStatusCode()
Retrieves the HTTP status code associated with this protocol error.- Returns:
- An
intrepresenting the HTTP status code.
-
getBody
public java.lang.String getBody()
Retrieves the response body associated with this protocol error, if available.- Returns:
- A
Stringcontaining the response body, ornullif the body is unavailable.
-
getQueryFailure
public java.util.Optional<QueryFailure> getQueryFailure()
Retrieves theQueryFailuredetails associated with this protocol error, if available.- Returns:
- An
Optional<QueryFailure>containing the failure details, orOptional.empty()if not present.
-
-