Handling a missing definition error when executing a DMN by variable


I’m looking to execute a decision table using a variable - the use case is that the actual decision ref is found through a previous look up. In that case i can use an expression to invoke the table ${tableToCall}.

However, if the referenced table doesn’t exist then camunda throws a org.camunda.bpm.engine.exception.dmn.DecisionDefinitionNotFoundException exception. In my case i’d like to handle that in the business logic, but I can’t work out how to catch it in a boundary error?

I have tried the approach mentioned here: Generic error handling block

but setting the ‘code’ to org.camunda.bpm.engine.exception.dmn.DecisionDefinitionNotFoundException doesn’t seem to work :frowning:

It may well be that what I’m trying to isn’t possible?

If catching the error isn’t possible, can I use a script task to check if a particular dmn id exists?

Thanks for any help

Well - I’ve sort of half answered it myself…

If i create a script task and execute the following:

const tableToCall = 'foobar';
const dmnDefinition = execution.getProcessEngineServices().getRepositoryService().createDecisionDefinitionQuery().decisionDefinitionKey(tableToCall).singleResult();

Then the boundary error is triggered.

So - I can do what I want to do, but not in the way that I wanted to.