Package com.cercalia.sdk.exception
Class CercaliaException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
com.cercalia.sdk.exception.CercaliaException
- All Implemented Interfaces:
Serializable
Base exception class for all Cercalia SDK errors.
This exception is thrown when an API request fails, either due to network issues, invalid parameters, or specific error codes returned by the Cercalia Web Services (e.g., "30006" for no candidates found).
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionCercaliaException(String message) Creates a newCercaliaExceptionwith a message.CercaliaException(String message, @Nullable String errorCode) Creates a newCercaliaExceptionwith a message and error code.CercaliaException(String message, @Nullable String errorCode, Throwable cause) Creates a newCercaliaExceptionwith a message, error code, and cause.CercaliaException(String message, Throwable cause) Creates a newCercaliaExceptionwith a message and cause. -
Method Summary
Modifier and TypeMethodDescription@Nullable StringReturns the Cercalia error code, if available.booleanChecks if this exception represents a "no candidates found" error.booleanChecks if this exception represents a "no results found" error.Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
CercaliaException
Creates a newCercaliaExceptionwith a message.- Parameters:
message- the error message.
-
CercaliaException
Creates a newCercaliaExceptionwith a message and error code.- Parameters:
message- the error message.errorCode- the Cercalia error code.
-
CercaliaException
Creates a newCercaliaExceptionwith a message and cause.- Parameters:
message- the error message.cause- the underlying cause.
-
CercaliaException
Creates a newCercaliaExceptionwith a message, error code, and cause.- Parameters:
message- the error message.errorCode- the Cercalia error code.cause- the underlying cause.
-
-
Method Details
-
getErrorCode
Returns the Cercalia error code, if available.- Returns:
- the error code, or
nullif not available.
-
isNoCandidatesFound
public boolean isNoCandidatesFound()Checks if this exception represents a "no candidates found" error. This is not a system error but indicates an empty result set.- Returns:
trueif this is a "no candidates found" error.
-
isNoResultsFound
public boolean isNoResultsFound()Checks if this exception represents a "no results found" error. This is an alias forisNoCandidatesFound()for consistency across services.- Returns:
trueif this is a "no results found" error.
-