Matthieu Laurent · Jun 24, 2019

Try/Catch within BP

Hello everyone,


I'm facing an issue i would like to resolve :).

I have a BPL which throw a DTL. My DTL has many reasons to raise an Exception.


I would like to catch this exception within my BP with a SCOPE but it does not work.

The BP seems to catch its own Exception but does not care at all of my DTL Exception.


So, is it possible to use the SCOPE in my case ? Otherwise, how can I handle the exception in my DTL ?


Thanks a lot for your reply.



0 420
Discussion (4)0
Log in or sign up to continue

I would expect the "catchall" to work in this situation - it's how I catch general exceptions not otherwise handled. Are you using "catchall" or attempting to "catch" a particular exception with catch? If using catch, a gotcha for new players is that it only works in conjunction with a BPL "throw" as it will only catch based on a string in a corresponding throw and not based on a %Status value or %Exception or whatever.

<scope xpos='200' ypos='250' xend='200' yend='800' >
<code name='Transform' xpos='200' ypos='350' >
     If I use a <transform> activity with indirection (@$parameter(request,"%DTL")), and 
     assign the returned object to the context, and an error is produced when the context is
     saved because the returned object has, say, missing properties, IRIS will only see this error
     too late and the scope we defined will not be able to help us to deal with this fault.
     So, in order to avoid this bug, we need to call the transformation from a <code> activity instead.
     And try to save the returned object before assigning it to the context and returning. If we can't
     save it, we must assign the error to the status variable and leave the context alone. This way
     the <scope> will capture the problem and take us to the <catchall> activity. 
    Set tTransformClass=$parameter(request,"%DTL")
    Set status = $classmethod(tTransformClass, "Transform", request, .normalizedRequest)
    If $$$ISERR(status) Quit
    Set status = normalizedRequest.%Save()
    If $$$ISERR(status) Quit
    Set context.NormalizedData=normalizedRequest
</code> <assign name="Done" property="context.Action" value="&quot;Done&quot;" action="set" xpos='200' ypos='550' /> <faulthandlers>    <catchall name='Normalization error' xpos='200' ypos='650' xend='200' yend='1150' >
      <trace name='Normalization problem' value='"Normalization problem"' xpos='200' ypos='250' />

Hi @Matthieu

I am facing the same issue. Did you ever figured out how to catch exceptions thrown by your DTL ?

Many thanks,


Is Amir's solution not satisfactory?

In some cases, it is preferable to use a < code > activity that directly calls the transformation and assigns the status code to the status variable, which will be processed by the try/catch.

 Set status = $classmethod(tTransformClass, "Transform", request, .normalizedRequest