I am fetching data from DB using select adapater. I need throw custom custom exception if the select adapater received zero rows ($rowcount = 0). Please let me know step by step procedure for craeting custom exception in webmethods

I am fetching data from DB using select adapater. I need throw custom custom exception if the select adapater received zero rows ($rowcount = 0). Please let me know step by step procedure for creating custom exception in webMethods.

later I will handle that exception in catch block.

Hi Mareedu,

one option might be to wrap the select adapter service in a flow service.
Branch on $rowcount, when it is zero exit the service with Signal Failure and provide a message indicating that rowcount was zero.

Regards,
Holger

I want execution to come into catch block. If I use exit step execution is not coming into catch block.

Hi Mareedu,

can you provide some screenshots of your planned service invocation of the select adapter then, please?
Whether select adapter returns data or only $rowcount=0, it will signal always Success to the invoker, which will not trigger any catch block.

Therefore the suggestion with the intermediate wrapper service to signal Failure via Exit step, which then can be used to trigger the catch block of the invoker.

Regards,
Holger

Hi Mareedu,

If you still want that execution come to catch you can try this way.
failing the flow at count=0, in this case your flow will move to the catch block, but you have to overwrite the error in the lastError document if you invoke getLastError service.
error1

This is just a thought !

Thank You!

1 Like

If you want to catch the exception in catch block that also means you don’t need an exception. If you really need an exception, you need 3 sequences. One outer, 2 inner. First inner will set to exit on failure this is the try block, second inner will be set to exit on done this is the catch block, outter is set to exit on success. You need to signal in the first sequence using EXIT service but make sure it is set to exit from $parent as seen in the picture. If you set it to exit from flow it will exit from your try catch as well.
image

New versions also have pre-defined try-catch services. You can also use them instead of creating 3 sequences.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.