Package io.helidon.integrations.jta.jdbc
Interface ExceptionConverter
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
A functional interface whose implementations can convert a kind of
Exception
encountered in the context of an XA routine to an appropriate XAException
, according
to the rules in the XA specification as
expressed in the documentation for the XAResource
interface.-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic enum
An enum describing XA routines modeled by anXAResource
implementation. -
Method Summary
Modifier and TypeMethodDescriptionstatic String
codeToString
(int code) Returns a non-null
String
representation of the supplied code.convert
(ExceptionConverter.XARoutine xaRoutine, Exception exception) Converts the suppliedException
encountered in the context of the suppliedExceptionConverter.XARoutine
to anXAException
with an appropriate error code, idiomatically following the rules of the XA specification.
-
Method Details
-
convert
Converts the suppliedException
encountered in the context of the suppliedExceptionConverter.XARoutine
to anXAException
with an appropriate error code, idiomatically following the rules of the XA specification.- Parameters:
xaRoutine
- theExceptionConverter.XARoutine
; must not benull
exception
- theException
to convert; most commonly a variety ofSQLException
orRuntimeException
; if supplied with anXAException
thisExceptionConverter
must simply return it; if supplied withnull
a newXAException
with a general-purpose error codemust be returned- Returns:
- a suitable non-
null
XAException
- Throws:
NullPointerException
- ifroutine
isnull
- See Also:
-
codeToString
Returns a non-null
String
representation of the supplied code.The format of the returned
String
is left deliberately undefined and may change between versions of this interface without prior notice.- Parameters:
code
- a code; usually the value of astatic
field in theXAException
class- Returns:
- a non-
null
String
representation of the supplied code
-