cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X

How can I get PostJSON return value when network diconnected

kpark1
1-Newbie

How can I get PostJSON return value when network diconnected

I want to get return value from PostJSON when network disconnected

what is returned and how can I get value?

thank you

1 ACCEPTED SOLUTION

Accepted Solutions
ankigupta
5-Regular Member
(To:kpark1)

Hi kiyong park​,

If there is any error in the custom code; system prints it in the script logs.

And I just tried it myself and got following error when there is no network:

JavaException: java.net.NoRouteToHostException: No route to host: connect

I used try/catch block to catch the error and wrote some code to do some stuff when this error occurs.

I hope it helps.

View solution in original post

4 REPLIES 4
ankigupta
5-Regular Member
(To:kpark1)

Hi kiyong park​,

As per my understanding; the PostJSON will error out when there is no connection.

You can try to use a try catch block to handle that error.

I hope it helps.

Thank you Ankit

I have two more questions though I will try to use a try catch block.

Is not there any return value in internal system when error occur?

And Can't I treat PostJSON error value?

ankigupta
5-Regular Member
(To:kpark1)

Hi kiyong park​,

If there is any error in the custom code; system prints it in the script logs.

And I just tried it myself and got following error when there is no network:

JavaException: java.net.NoRouteToHostException: No route to host: connect

I used try/catch block to catch the error and wrote some code to do some stuff when this error occurs.

I hope it helps.

Thank you for your help.

Top Tags