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
FaunaException
to provide details specific to protocol errors.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ProtocolException(int statusCode, QueryFailure failure)
Constructs aProtocolException
with the specified HTTP status code andQueryFailure
details.ProtocolException(int statusCode, java.lang.String body)
Constructs aProtocolException
with the specified HTTP status code and response body.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getBody()
Retrieves the response body associated with this protocol error, if available.java.util.Optional<QueryFailure>
getQueryFailure()
Retrieves theQueryFailure
details associated with this protocol error, if available.int
getStatusCode()
Retrieves the HTTP status code associated with this protocol error.
-
-
-
Constructor Detail
-
ProtocolException
public ProtocolException(int statusCode, QueryFailure failure)
Constructs aProtocolException
with the specified HTTP status code andQueryFailure
details.- Parameters:
statusCode
- The HTTP status code received.failure
- TheQueryFailure
object containing details about the protocol failure.
-
ProtocolException
public ProtocolException(int statusCode, java.lang.String body)
Constructs aProtocolException
with the specified HTTP status code and response body.- Parameters:
statusCode
- The HTTP status code received.body
- AString
containing 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
int
representing the HTTP status code.
-
getBody
public java.lang.String getBody()
Retrieves the response body associated with this protocol error, if available.- Returns:
- A
String
containing the response body, ornull
if the body is unavailable.
-
getQueryFailure
public java.util.Optional<QueryFailure> getQueryFailure()
Retrieves theQueryFailure
details associated with this protocol error, if available.- Returns:
- An
Optional<QueryFailure>
containing the failure details, orOptional.empty()
if not present.
-
-