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
FaunaException
and 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 newServiceException
with the specifiedQueryFailure
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, containing key-value pairs of tags.QueryFailure
getResponse()
Returns theQueryFailure
response associated with this exception.java.lang.Long
getSchemaVersion()
Returns the schema version used during query execution.QueryStats
getStats()
Returns the statistics associated with the failed query.int
getStatusCode()
Returns the HTTP status code of the response returned by the query request.java.lang.String
getSummary()
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 newServiceException
with the specifiedQueryFailure
response.- Parameters:
response
- TheQueryFailure
object containing details about the failed query.
-
-
Method Detail
-
getResponse
public QueryFailure getResponse()
Returns theQueryFailure
response associated with this exception.- Returns:
- The
QueryFailure
object 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
String
containing the error summary.
-
getStats
public QueryStats getStats()
Returns the statistics associated with the failed query.- Returns:
- A
QueryStats
object 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
Long
value.
-
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.
-
-