Package com.fauna.exception
Class ServiceException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- java.lang.RuntimeException
-
- com.fauna.exception.FaunaException
-
- com.fauna.exception.ServiceException
-
- All Implemented Interfaces:
java.io.Serializable
- Direct Known Subclasses:
AbortException,AuthenticationException,AuthorizationException,ConstraintFailureException,ContendedTransactionException,InvalidRequestException,QueryCheckException,QueryRuntimeException,QueryTimeoutException,ServiceInternalException,ThrottlingException
public class ServiceException extends FaunaException
An exception representing a query failure returned by Fauna.This exception extends
FaunaExceptionand provides detailed information about the failed query, including HTTP status codes, error codes, statistics, and other metadata.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ServiceException(QueryFailure response)Constructs a newServiceExceptionwith the specifiedQueryFailureresponse.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetErrorCode()Returns the Fauna error code associated with the failure.java.util.Map<java.lang.String,java.lang.String>getQueryTags()Returns a map of query tags for the failed query, containing key-value pairs of tags.QueryFailuregetResponse()Returns theQueryFailureresponse associated with this exception.java.lang.LonggetSchemaVersion()Returns the schema version used during query execution.QueryStatsgetStats()Returns the statistics associated with the failed query.intgetStatusCode()Returns the HTTP status code of the response returned by the query request.java.lang.StringgetSummary()Returns a brief summary of the error.java.util.Optional<java.lang.Long>getTxnTs()Returns the last transaction timestamp seen for the failed query, if available.
-
-
-
Constructor Detail
-
ServiceException
public ServiceException(QueryFailure response)
Constructs a newServiceExceptionwith the specifiedQueryFailureresponse.- Parameters:
response- TheQueryFailureobject containing details about the failed query.
-
-
Method Detail
-
getResponse
public QueryFailure getResponse()
Returns theQueryFailureresponse associated with this exception.- Returns:
- The
QueryFailureobject containing details of the query failure.
-
getStatusCode
public int getStatusCode()
Returns the HTTP status code of the response returned by the query request.- Returns:
- The HTTP status code as an integer.
-
getErrorCode
public java.lang.String getErrorCode()
Returns the Fauna error code associated with the failure.Fauna error codes indicate the specific cause of the error and are part of the API contract, allowing for programmatic logic based on the error type.
- Returns:
- The error code as a
String.
-
getSummary
public java.lang.String getSummary()
Returns a brief summary of the error.- Returns:
- A
Stringcontaining the error summary.
-
getStats
public QueryStats getStats()
Returns the statistics associated with the failed query.- Returns:
- A
QueryStatsobject containing statistical information for the failed query.
-
getTxnTs
public java.util.Optional<java.lang.Long> getTxnTs()
Returns the last transaction timestamp seen for the failed query, if available.- Returns:
- An
Optional<Long>representing the last transaction timestamp, orOptional.empty()if not available.
-
getSchemaVersion
public java.lang.Long getSchemaVersion()
Returns the schema version used during query execution.- Returns:
- The schema version as a
Longvalue.
-
getQueryTags
public java.util.Map<java.lang.String,java.lang.String> getQueryTags()
Returns a map of query tags for the failed query, containing key-value pairs of tags.- Returns:
- A
Map<String, String>with query tags.
-
-