REST API - Exception details

Hello,

So when a request is done to the REST API, which then fails, we only get the topmost exception message. This is handled by the following code:

Especially when testing DMN expressions, it can be very helpful to know the underlying error.

For example, when an expression evaluation fails with the following error:

Caused by: org.camunda.bpm.engine.ProcessEngineException: Exception while evaluating decision with key    'null'
(...)
Caused by: org.camunda.bpm.dmn.engine.impl.DmnEvaluationException: DMN-01002 Unable to evaluate expression for language 'feel': 'klant'
(...)
Caused by: javax.script.ScriptException: failed to evaluate expression 'klant':
no variable found for name 'klant'
(...)

Only the first message is relayed to the client:

Caused by: org.camunda.bpm.engine.ProcessEngineException: Exception while evaluating decision with key 'null'

Now, I’m looking for some advice as to how to fix this.

  1. Should this be presented as a PR to the engine?
    I can imagine there are good reasons for this, so I don’t know if it’s something to “fix” persé.

  2. Could this be done using a plugin?
    If so, I’d like a little guidance on where to start. I don’t mind to solve this using a plugin, but I don’t know yet if that’s the way to go or if it’s even possible.

Thanks in advance!

Feel always free to raise pull requests. My personal impression is that this is a very specific request and I’m not sure a larger userbase would benefit from it.

You could consider shipping a custom REST API that embeds the resources and adds a customer exception mapper. This is documented here: Embed the API | docs.camunda.org

For the use case of testing, I would consider writing Java unit tests over a REST-based test as well.

Cheers,
Thorben

1 Like