Package org.kiwiproject.consul
Class ConsulException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
org.kiwiproject.consul.ConsulException
- All Implemented Interfaces:
Serializable
Wraps an exception thrown whilst interacting with the Consul API.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionConsulException(int code, retrofit2.Response<?> response) ConsulException(String message) Constructs an instance of this class.ConsulException(String message, Throwable throwable) Constructs an instance of this class.ConsulException(Throwable throwable) -
Method Summary
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
ConsulException
Constructs an instance of this class.- Parameters:
message- The exception message.
-
ConsulException
Constructs an instance of this class.- Parameters:
message- The exception message.throwable- The wrappedThrowableobject.
-
ConsulException
public ConsulException(int code, retrofit2.Response<?> response) -
ConsulException
-
-
Method Details
-
hasCode
public boolean hasCode()Check whether this exception is known to have been caused by an HTTP error.- Returns:
- true if this exception was definitely caused by an HTTP error, otherwise false
- See Also:
-
getCode
public int getCode()Get the HTTP status code that caused this exception, if any.- Returns:
- the HTTP error code, or zero if not known to have been caused by an HTTP error
- See Also:
-