Skip to content

Commit

Permalink
Added variables errorCode and errorMsg to C7WorkerHandler.
Browse files Browse the repository at this point in the history
  • Loading branch information
pme123 committed Nov 26, 2024
1 parent b7a83be commit a4cadcc
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
7 changes: 7 additions & 0 deletions 00-documentation/src/docs/generalConcerns.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,13 @@ If the error code is not enough, you can also add a list of regex expressions, t

For example, you want to handle a _400_ error, but only if the message contains _bad response_.

#### Error Variables

If an error is handled, the worker will add the following variables to the process:

- `errorCode: String` - the error code (`CamundalaWorkerError.errorCode`)
- `errorMsg: String` - the error message (`CamundalaWorkerError.errorMsg`)
-
### Authorization

#### Impersonate User
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,17 @@ trait C7WorkerHandler extends camunda.ExternalTaskHandler:
then
handleSuccess(filtered, generalVariables.manualOutMapping)
else
logger.info(s"Handled Error: ${error.causeMsg}")
val errorVars = Map(
"errorCode" -> error.errorCode,
"errorMsg" -> error.errorMsg
)
val variables = (filtered ++ errorVars).asJava
logger.info(s"Handled Error: $errorVars")
externalTaskService.handleBpmnError(
summon[camunda.ExternalTask],
s"${error.errorCode}",
error.errorMsg,
filtered.asJava
variables
)
)
case (true, false, _) =>
Expand Down

0 comments on commit a4cadcc

Please sign in to comment.