Skip to main content
Announcements
Introducing a new Enhanced File Management feature in Qlik Cloud! GET THE DETAILS!
cancel
Showing results for 
Search instead for 
Did you mean: 
kuwaryogi27
Creator
Creator

tRestClient error handling

Hello All,

I have a use case where tRestClient hits an API and if error generated then it should catch the error and next sub job should not be affected for execution. But unfortunately the job is getting terminated.

0693p000009q05IAAQ.png

I Also tried one other scenario where I have unselect the checkbox "DIE ON ERROR

"

in tRestClient in that case the sub job is working fine but no error catch happening in tDie which is connected ON ERROR of tRestClient.

0693p000009q05hAAA.png

Please guide me

Thanks in advance.

Labels (2)
1 Solution

Accepted Solutions
pakapi_
Creator
Creator

Hello  kuwaryogi27,

 

do you really need tDie ? Maybe tWarn will be better? Try to replace it with Die on error checked in tRestClient.

View solution in original post

8 Replies
pakapi_
Creator
Creator

Hello  kuwaryogi27,

 

do you really need tDie ? Maybe tWarn will be better? Try to replace it with Die on error checked in tRestClient.

Jesperrekuh
Specialist
Specialist

It provides a <null> status code when a 200 is given and a valid status code when anything other than 200 is given.

Your row errors are perfectly fine no exception is raised. so after youve done add java component and in java code Throw Exception() or something like that. Google for some correct proper code.

 

kuwaryogi27
Creator
Creator
Author

Hello @Kamil Kowalczyk​ ,

 

Yes this worked for me, Thank you for your guidance.

kuwaryogi27
Creator
Creator
Author

 

Screenshot of design:

 

0693p000009qF45AAE.pngHello @Jesper van​ ,

 

Yes your guidance worked for me what I implemented from you comment is in below screenshot,

I was not able to handle java.net.SocketTimeoutException: SocketTimeoutException

 

eg: In tRestClient when Die on error checkbox is selected the job was getting terminated without the exception getting caught in tWarn so parallel to it I used tRestClient -> On component error -> tJava

 

In tJava fetched the exception raised by tRestClient ((String)globalMap.get("tRESTClient_1_ERROR_MESSAGE")) and on component ok connected to next subjob.

 

 

But one concern over here as you can see in screenshot the first job is not terminated how can I resolve that.

 

Thank you for your guidance, waiting for your response for my above concern.

Thanks in advance.

 

kuwaryogi27
Creator
Creator
Author

Hello @Kamil Kowalczyk​ ,

 

tWarn is not handling the socket timeout exception. Is there some way to handle it I want the next subjob to work. In below comment in this same thread mentioning you what I did for this but have one concern the first subjob did not ended and job got disconnected on successful completion of below connected subjob.

 

0693p000009qF45AAE.png

pakapi_
Creator
Creator

I'm not sure if it's what you want, but try to use OnComponentOK between tJava_4 and tChronometerStop_* . Make sure that this connection is the first one (order 1). Then do OnComponentOk between tJava_4 and tChronometerStart_2.

kuwaryogi27
Creator
Creator
Author

Hello @Kamil Kowalczyk​ ,

I did this but the response was same, it displays Starting on further flow(tMap_7 and further)

But anyways this is not stopping our work.

Thanks for your valuable time and comment.

pakapi_
Creator
Creator

Hi kuwaryogi27,

 

I think I know how to do this. This behaviour is normal for this component - the Response is always (good or bad). To stop the response flow, you have to use RunIf link somewhere after tMap7 (I don't know what is happening inside next components), and write some condition based on statusCode. Please try, and let me know 🙂