Skip to main content
1-Visitor
April 21, 2017
Solved

How can I get PostJSON return value when network diconnected

  • April 21, 2017
  • 4 replies
  • 1967 views

I want to get return value from PostJSON when network disconnected

what is returned and how can I get value?

thank you

    Best answer by ankigupta

    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.

    4 replies

    5-Regular Member
    April 21, 2017

    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.

    kpark11-VisitorAuthor
    1-Visitor
    April 24, 2017

    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?

    ankigupta5-Regular MemberAnswer
    5-Regular Member
    April 24, 2017

    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.