Package io.dapr.exceptions
Class DaprException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
io.dapr.exceptions.DaprException
- All Implemented Interfaces:
Serializable
public class DaprException extends RuntimeException
A Dapr's specific exception.
- See Also:
- Serialized Form
-
Constructor Summary
Constructors Constructor Description DaprException(DaprError daprError)
New exception from a server-side generated error code and message.DaprException(DaprError daprError, Exception cause)
New exception from a server-side generated error code and message.DaprException(Exception exception)
Wraps an exception into a DaprException.DaprException(String errorCode, String message)
New Exception from a client-side generated error code and message.DaprException(String errorCode, String message, Exception cause)
New exception from a server-side generated error code and message. -
Method Summary
Modifier and Type Method Description String
getErrorCode()
Returns the exception's error code.static void
throwIllegalArgumentException(String message)
Convenience to throw an wrapped IllegalArgumentException.static DaprException
wrap(Exception exception)
Wraps an exception into DaprException (if not already DaprException).static <T> Callable<T>
wrap(Callable<T> callable)
Wraps a callable with a try-catch to throw DaprException.static <T> reactor.core.publisher.Mono<T>
wrapMono(Exception exception)
Wraps an exception into DaprException (if not already DaprException).Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
DaprException
New exception from a server-side generated error code and message.- Parameters:
daprError
- Server-side error.
-
DaprException
New exception from a server-side generated error code and message.- Parameters:
daprError
- Client-side error.cause
- the cause (which is saved for later retrieval by theThrowable.getCause()
method). (Anull
value is permitted, and indicates that the cause is nonexistent or unknown.)
-
DaprException
Wraps an exception into a DaprException.- Parameters:
exception
- the exception to be wrapped.
-
DaprException
New Exception from a client-side generated error code and message.- Parameters:
errorCode
- Client-side error code.message
- Client-side error message.
-
DaprException
New exception from a server-side generated error code and message.- Parameters:
errorCode
- Client-side error code.message
- Client-side error message.cause
- the cause (which is saved for later retrieval by theThrowable.getCause()
method). (Anull
value is permitted, and indicates that the cause is nonexistent or unknown.)
-
-
Method Details
-
getErrorCode
Returns the exception's error code.- Returns:
- Error code.
-
throwIllegalArgumentException
Convenience to throw an wrapped IllegalArgumentException.- Parameters:
message
- Message for exception.
-
wrap
Wraps an exception into DaprException (if not already DaprException).- Parameters:
exception
- Exception to be wrapped.- Returns:
- DaprException.
-
wrap
Wraps a callable with a try-catch to throw DaprException.- Type Parameters:
T
- type to be returned- Parameters:
callable
- callable to be invoked.- Returns:
- object of type T.
-
wrapMono
Wraps an exception into DaprException (if not already DaprException).- Type Parameters:
T
- Mono's response type.- Parameters:
exception
- Exception to be wrapped.- Returns:
- Mono containing DaprException.
-