Class ExceptionCodeInterceptor
- java.lang.Object
-
- org.camunda.bpm.engine.impl.interceptor.CommandInterceptor
-
- org.camunda.bpm.engine.impl.interceptor.ExceptionCodeInterceptor
-
- All Implemented Interfaces:
CommandExecutor
public class ExceptionCodeInterceptor extends CommandInterceptor
A command interceptor to catch
ProcessEngineException
errors and assign error codes.The interceptor assigns an error code to the
ProcessEngineException
based on the built-in or customExceptionCodeProvider
.
-
-
Field Summary
Fields Modifier and Type Field Description protected ExceptionCodeProvider
builtinExceptionCodeProvider
protected ExceptionCodeProvider
customExceptionCodeProvider
protected static CommandLogger
LOG
static int
MAX_CUSTOM_CODE
static int
MIN_CUSTOM_CODE
-
Fields inherited from class org.camunda.bpm.engine.impl.interceptor.CommandInterceptor
next
-
-
Constructor Summary
Constructors Constructor Description ExceptionCodeInterceptor(ExceptionCodeProvider builtinExceptionCodeProvider, ExceptionCodeProvider customExceptionCodeProvider)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
assignCodeToException(ProcessEngineException pex)
protected boolean
codeReserved(Integer code)
<T> T
execute(Command<T> command)
protected Integer
provideCode(ProcessEngineException pex, int initialCode)
protected Integer
provideCodeBySupplier(Supplier<Integer> builtinSupplier, Supplier<Integer> customSupplier, int initialCode)
Built-in code provider has precedence over custom code provider and initial code (assigned via delegation code).protected Integer
tryResetReservedCode(Integer code)
Resets codes to theBuiltinExceptionCode.FALLBACK
in case they are <MIN_CUSTOM_CODE
or >MAX_CUSTOM_CODE
.-
Methods inherited from class org.camunda.bpm.engine.impl.interceptor.CommandInterceptor
getNext, setNext
-
-
-
-
Field Detail
-
LOG
protected static final CommandLogger LOG
-
MIN_CUSTOM_CODE
public static final int MIN_CUSTOM_CODE
- See Also:
- Constant Field Values
-
MAX_CUSTOM_CODE
public static final int MAX_CUSTOM_CODE
- See Also:
- Constant Field Values
-
builtinExceptionCodeProvider
protected ExceptionCodeProvider builtinExceptionCodeProvider
-
customExceptionCodeProvider
protected ExceptionCodeProvider customExceptionCodeProvider
-
-
Constructor Detail
-
ExceptionCodeInterceptor
public ExceptionCodeInterceptor(ExceptionCodeProvider builtinExceptionCodeProvider, ExceptionCodeProvider customExceptionCodeProvider)
-
-
Method Detail
-
execute
public <T> T execute(Command<T> command)
-
provideCodeBySupplier
protected Integer provideCodeBySupplier(Supplier<Integer> builtinSupplier, Supplier<Integer> customSupplier, int initialCode)
Built-in code provider has precedence over custom code provider and initial code (assigned via delegation code). Custom and initial code is tried to be reset in case it violates the reserved code range.
When
disableBuiltInExceptionCodeProvider
flag inProcessEngineConfigurationImpl
is configured totrue
, custom provider can override reserved codes.
-
provideCode
protected Integer provideCode(ProcessEngineException pex, int initialCode)
-
tryResetReservedCode
protected Integer tryResetReservedCode(Integer code)
Resets codes to theBuiltinExceptionCode.FALLBACK
in case they are <MIN_CUSTOM_CODE
or >MAX_CUSTOM_CODE
. No log is written when code isBuiltinExceptionCode.FALLBACK
.
-
codeReserved
protected boolean codeReserved(Integer code)
-
assignCodeToException
protected void assignCodeToException(ProcessEngineException pex)
-
-