BPM, Workflow, and Case

 View Only
Expand all | Collapse all

IBM BAW: How can I get Process Inspector to display my process error message?

  • 1.  IBM BAW: How can I get Process Inspector to display my process error message?

    Posted Fri January 07, 2022 12:47 PM

    I am trying to build a simple process in BAW that is supposed to work as follows:

    The process calls a service flow. When an error is detected in the service flow, the error is caught by the process, printed to the logs and then the process ends on an Error End Event so that the process instance status is set to 'Failed'. Here is how it looks like:


    Catching the error and printing it to the logs works as expected but when the process reaches the Error End Event and the process instance is set to failed, the instance error details shown in Process Inspector always say "No error message". Only the error code specified for the Error End Event is correctly reflected in the details:


    No matter what data or data type I hand over as Error Data in the Error Mapping section of the Error End Event properties, the output in Process Inspector is always the same: "No error message".

    Can anyone tell me how I could get the error message contained in my Error Data object into the instance error details displayed in Process Inspector?
    If it is not possible at all, I would like to understand why. Thanks in advance for your help!



    ------------------------------
    Gregor Schikorski
    ------------------------------


  • 2.  RE: IBM BAW: How can I get Process Inspector to display my process error message?

    Posted Tue January 11, 2022 02:40 AM
    Hi Gregor,

    I think, as you are failing the instance using error end, the variable values are getting lost, even the default instance error value is getting lost.
    Till the step "Log Error Message", the values will be persisted but once the token reaches to Error End, the values will be lost.
    May I know the purpose of expecting the error in the process inspector ? 

    Thanks!


    ------------------------------
    Atanu Roy
    Solution Architect
    Salient Process
    ------------------------------



  • 3.  RE: IBM BAW: How can I get Process Inspector to display my process error message?

    Posted Tue January 11, 2022 04:55 AM
    Hi Atanu,

    thanks for your reply.

    It would be good to have the error message in Process Inspector so the process administrators can see the reason for the failure. Reading the full error message, they could better understand the problem that has occurred and decide how the failed instance should be handled: whether or not a failed task should be repeated, whether the token must be moved or whether additional correction is required. Usually, these actions are taken in Process Inspector, so it would be great to have the info right there.

    Since the error code is successfully preserved when the instance reaches the Error End Event and can be displayed in Process Inspector, I would have assumed that the same was possible for the error message, which is just another process variable. Can you explain the difference?
    And what is the point of including a message tag in the instance error displayed in Process Inspector if the message is always empty?

    Best regards
    Gregor

    ------------------------------
    Gregor Schikorski
    ------------------------------



  • 4.  RE: IBM BAW: How can I get Process Inspector to display my process error message?

    Posted Fri January 14, 2022 01:01 AM
    Hi Gregor,

    I could preserver the error by doing below implementation - 





    Error


    ------------------------------
    Atanu Roy
    Solution Architect
    Salient Process
    ------------------------------



  • 5.  RE: IBM BAW: How can I get Process Inspector to display my process error message?

    Posted Fri January 14, 2022 10:56 AM

    Hi Atanu,

    thanks for your reply.

    I think the reason why it seems to work in your scenario is that you do not really catch the thrown runtime error. As you can see, the custom error code you defined ('MyErrorCode') is not mentioned in the Process Inspector's error details.

    The uncaught error will still lead to a failed process instance and in such scenarios (uncaught runtime errors), there is indeed an error message in Process Inspector. However, it never works for custom errors defined on an Error End Event in a process.

    Surprisingly, if I take my sample process and use it as a linked process within another process, the enclosing process can catch and consume the custom error code AND custom error message delivered by the linked process via the Error End Event. Only Process Inspector is apparently not capable of consuming the custom error message. I think this is a product deficiency.

    Best regards
    Gregor



    ------------------------------
    Gregor Schikorski
    ------------------------------



  • 6.  RE: IBM BAW: How can I get Process Inspector to display my process error message?

    Posted Fri January 14, 2022 11:59 AM
    Hi Gregor,

    Yes, you are correct, I way I implemented, its not capturing the specific error.
    I also think the product does not support this facility. We are trying to set an error code and a message at the error end event and there is no one to consume the error message from the error end event. Ideally it should not have considered the error code set from the last error end event. I think it is picking the error code up because it's not a mapping, it's directly getting mapped to the process instance's error code but the error data is a kind of mapping where in this case there is no right hand side mapping. Although this is my guess. I tried setting a variable at the pre execution of the error end, that didn't pick the value as well.
    So, kind of limitation here.


    ------------------------------
    Atanu Roy
    Solution Architect
    Salient Process
    ------------------------------



  • 7.  RE: IBM BAW: How can I get Process Inspector to display my process error message?

    Posted Fri January 28, 2022 10:18 AM
    Edited by Mattias Edling Fri January 28, 2022 10:18 AM
    I found this interesting, but it actually took a few visits before I realized that you are catching technical errors (as opposed to business exceptions) in the business process layer. Normally I catch, log and re-throw in the service layer. Is that not an option? The bonus of doing so is being able to retry failed step within the service, in addition to the option of moving the token. Stupid question: Is there even a token if the process ends by an error event?

    ------------------------------
    Mattias Edling
    ------------------------------



  • 8.  RE: IBM BAW: How can I get Process Inspector to display my process error message?

    Posted Fri January 28, 2022 12:18 PM

    Thanks for your comments, Mattias.

    If you are at the process layer, I think there are basically three options how you can deal with an exception thrown in an executed service:

    1. You do not catch the exception at all or you catch it at the service layer, do something (e.g. log output) and re-throw it without catching anything at the process layer. Either way, the exception will interrupt the processing and the process instance will be set to status 'Failed'. No further steps in the process are taken. If the exception is a custom one, Process Inspector will not reveal much about the cause of the encountered failure.

    2. You catch the service exception at the process layer and let the process continue. That way, further required process steps can be taken and the process can still end gracefully with status 'Completed'. However, if you check your instances in Process Inspector later on, it will probably be difficult to tell which instances had problems as they are all completed.

    3. You catch the service exception at the process layer and let the process continue (down the designated error path). That way, further required process steps can be taken. However, you do not want the process instance to show as completed because it actually failed, so you let the process run into an Error End Event. The instance status is set to 'Failed'. Process Inspector should tell you which exception was encountered. Unfortunately, it does not.

    Personally, I do not like option 1 because I am keen on taking a few more process steps before I let the exception kill the flow. Moving tokens can be helpful sometimes but it should be the last resort in my opinion.
    Option 2 leads to completed instances but I would like to have failed ones to get proper statistics, so I don't like this option, either.
    Option 3 is my favorite and it actually works as expected - well, except for Process Inspector's incapability of displaying the error message handed over via the final Error End Event.

    As mentioned in my comments to Atanu, I do not understand why Process Inspector cannot consume the error message. Any other process can. I think the fact that Process Designer enables you to use Error End Events at the process layer means that it is supposed to work. That's why I believe this is nothing but a deficiency in Process Inspector.



    ------------------------------
    Gregor Schikorski
    ------------------------------



  • 9.  RE: IBM BAW: How can I get Process Inspector to display my process error message?

    Posted Wed March 02, 2022 03:31 PM

    I think I am ready to continue the discussion and must admit some statements came out of my long-term memory. It was a while since I last did these things until just recently. I think I remember using 1. for system tasks in processes that mostly contained human tasks. If data or network problems caused error the instance would fail and we could then retry-revive it. Skipping or terminating is generally not an option. My current application under development is like this.

    There are some strange behaviours when retrying failed steps.

    Catching and rethrowing in the service flow seems to make the error end event the new failed step or something. The same error occurs again even after correcting the root cause. Also, process inspector is not displaying the correct details.

    If I don't catch anything, retry works. However it reruns the whole task service (the topmost service flow) even when the error occured halfway in, say at the third step which is nested service. This is apparent from log entries in each step. I vaguely recall that retry, at least in 8.0.x, started after the last successful step or at least at the beginning of the affected service.

    Next strange things is that the product documentation states that retry does not work for system tasks: 

    https://www.ibm.com/docs/en/baw/20.x?topic=inspector-actions-in-process

    But it does now and I am sure it did before. It would be unreasonable if one could not.

    I did these tests in BAW 20.0.2 Process Center, where I triggered the error by a script null pointer assignment. Upon error I commented it away, saved and retried failed steps.



    ------------------------------
    Mattias Edling
    ------------------------------



  • 10.  RE: IBM BAW: How can I get Process Inspector to display my process error message?

    Posted Wed March 02, 2022 06:50 PM

    My 2 cents:

    If you re-throw error from service flow  - default retry API (and button retry in Process Inspector) works as you described.  It basically  retries returning error from service to main process.

    This is not what you probably expect :)

    My workaround for that is to first reset token on last failed activity (place where you invoked service).

    This needs 2 REST API calls:

    • Get execution tree (GET /rest/bpm/wle/v1/process/<pid>?parts=executionTree)

           Find token for failed activity  (tokenId, flowObjectId –  first children under root)  

    • Set token in the same place  (PUT  /rest/bpm/wle/v1/process/<pid>?action=moveToken&tokenId=< tokenId>&target=< flowObjectId>&resume=true)

    After that  standard retry  (e.g  PUT  /rest/bpm/wle/v1/process/<pid>?action=retry  or pressing retry button in Process Inspector) will re-execute  whole service  (from the beginning of failed service).  

    To be honest I frequently re-implement functionality of Process Inspector to have more admins friendly tool. It requires some efforts but  BAW API is much more powerful than UI of Process Inspector.  

    E.g.   initial problem in this thread of getting (modeled) error can be easily solved using that call:

    GET /rest/bpm/wle/v1/process/errors?instanceIds=<pid>

    You will find there errorData attribute which contains (serialized as XML)  error object.

    It is not available  in Process Inspector, though.

    Retry functionality is mostly useful for system tasks – so documentation update done in this APAR  https://www.ibm.com/support/pages/apar/JR61296  is indeed rather misleading.



    ------------------------------
    Sebastian Tylko
    ------------------------------