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.The exception extends
FaunaException
and contains details about the failed query, including HTTP status codes, error codes, and other metadata.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ServiceException(QueryFailure response)
Constructs a new ServiceException with the specified QueryFailure response.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getErrorCode()
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.QueryFailure
getResponse()
Returns the QueryFailure response associated with the exception.long
getSchemaVersion()
The schema version that was used for query execution.QueryStats
getStats()
Returns the statistics for the failed query.int
getStatusCode()
Returns the HTTP status code of the response returned by the query request.java.lang.String
getSummary()
Returns a summary of the error.long
getTxnTs()
Returns the faled query's last transaction timestamp.
-
-
-
Constructor Detail
-
ServiceException
public ServiceException(QueryFailure response)
Constructs a new ServiceException with the specified QueryFailure response.- Parameters:
response
- the QueryFailure object containing details about the failed query
-
-
Method Detail
-
getResponse
public QueryFailure getResponse()
Returns the QueryFailure response associated with the exception.- Returns:
- the QueryFailure object
-
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.Codes indicate the cause of the error. It is safe to write programmatic logic against the code. They are part of the API contract.
- Returns:
- the error code as a String
-
getSummary
public java.lang.String getSummary()
Returns a summary of the error.- Returns:
- a String containing the error summary
-
getStats
public QueryStats getStats()
Returns the statistics for the failed query.- Returns:
- a QueryStats object containing statistical information
-
getTxnTs
public long getTxnTs()
Returns the faled query's last transaction timestamp.- Returns:
- the transaction timestamp as a long value
-
getSchemaVersion
public long getSchemaVersion()
The schema version that was used for query execution.- Returns:
- the schema version as a long value
-
getQueryTags
public java.util.Map<java.lang.String,java.lang.String> getQueryTags()
Returns a map of query tags for the failed query.- Returns:
- a Map containing query tags as key-value pairs
-
-