Skip to content

Commit a4cadcc

Browse files
committed
Added variables errorCode and errorMsg to C7WorkerHandler.
1 parent b7a83be commit a4cadcc

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

00-documentation/src/docs/generalConcerns.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,13 @@ If the error code is not enough, you can also add a list of regex expressions, t
183183

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

186+
#### Error Variables
187+
188+
If an error is handled, the worker will add the following variables to the process:
189+
190+
- `errorCode: String` - the error code (`CamundalaWorkerError.errorCode`)
191+
- `errorMsg: String` - the error message (`CamundalaWorkerError.errorMsg`)
192+
-
186193
### Authorization
187194

188195
#### Impersonate User

04-worker-c7spring/src/main/scala/camundala/camunda7/worker/C7WorkerHandler.scala

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,12 +142,17 @@ trait C7WorkerHandler extends camunda.ExternalTaskHandler:
142142
then
143143
handleSuccess(filtered, generalVariables.manualOutMapping)
144144
else
145-
logger.info(s"Handled Error: ${error.causeMsg}")
145+
val errorVars = Map(
146+
"errorCode" -> error.errorCode,
147+
"errorMsg" -> error.errorMsg
148+
)
149+
val variables = (filtered ++ errorVars).asJava
150+
logger.info(s"Handled Error: $errorVars")
146151
externalTaskService.handleBpmnError(
147152
summon[camunda.ExternalTask],
148153
s"${error.errorCode}",
149154
error.errorMsg,
150-
filtered.asJava
155+
variables
151156
)
152157
)
153158
case (true, false, _) =>

0 commit comments

Comments
 (0)