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
ProcessEngineExceptionerrors and assign error codes.The interceptor assigns an error code to the
ProcessEngineExceptionbased on the built-in or customExceptionCodeProvider.
-
-
Field Summary
Fields Modifier and Type Field Description protected ExceptionCodeProviderbuiltinExceptionCodeProviderprotected ExceptionCodeProvidercustomExceptionCodeProviderprotected static CommandLoggerLOGstatic intMAX_CUSTOM_CODEstatic intMIN_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 voidassignCodeToException(ProcessEngineException pex)protected booleancodeReserved(java.lang.Integer code)<T> Texecute(Command<T> command)protected java.lang.IntegerprovideCode(ProcessEngineException pex, int initialCode)protected java.lang.IntegerprovideCodeBySupplier(java.util.function.Supplier<java.lang.Integer> builtinSupplier, java.util.function.Supplier<java.lang.Integer> customSupplier, int initialCode)Built-in code provider has precedence over custom code provider and initial code (assigned via delegation code).protected java.lang.IntegertryResetReservedCode(java.lang.Integer code)Resets codes to theBuiltinExceptionCode.FALLBACKin case they are <MIN_CUSTOM_CODEor >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 java.lang.Integer provideCodeBySupplier(java.util.function.Supplier<java.lang.Integer> builtinSupplier, java.util.function.Supplier<java.lang.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
disableBuiltInExceptionCodeProviderflag inProcessEngineConfigurationImplis configured totrue, custom provider can override reserved codes.
-
provideCode
protected java.lang.Integer provideCode(ProcessEngineException pex, int initialCode)
-
tryResetReservedCode
protected java.lang.Integer tryResetReservedCode(java.lang.Integer code)
Resets codes to theBuiltinExceptionCode.FALLBACKin case they are <MIN_CUSTOM_CODEor >MAX_CUSTOM_CODE. No log is written when code isBuiltinExceptionCode.FALLBACK.
-
codeReserved
protected boolean codeReserved(java.lang.Integer code)
-
assignCodeToException
protected void assignCodeToException(ProcessEngineException pex)
-
-