Results 1 to 4 of 4

Thread: Lavastorm: TRY-CATCH for Http timeouts

  1. #1

    Default Lavastorm: TRY-CATCH for Http timeouts


    Is it possible to use the try/catch approach to catch a HttpNode timeout exception (Probably a Http Library node which lets us use Java code).

    Looking to build a logic as shown below into a Lavastorm. Expectation is to handle timeouts without the Node aborting (failing with a Red cross).

    // Create a DataInputStream for reading from socket
    DataInputStream din = new DataInputStream (connection.getInputStream());
    // Read data until end of data
    for (;
    String line = din.readLine();
    if (line != null)
    System.out.println (line);
    // Exception thrown when network timeout occurs
    catch (InterruptedIOException iioe)
    System.err.println ("Remote host timed out during read operation");


  2. #2
    Lavastorm Employee stonysmith's Avatar
    Join Date
    Nov 2006
    Grapevine Tx


    You could do that in a custom Python or Java node, but not in BrainScript, purely because BrainScript doesn't support Sockets.

  3. #3


    Are you writing/modifying an existing java node or trying to use the out of the box HTTP node?

    If writing/modifying a node with java, there are multiple ways to either a)set the timeout or b)catch the timeout and ignore it. See the following for further detail on the custom java solution to catch the All you would need to do is add the catch and gracefully exit the node without an error.

    If using the out of the box node, there's a parameter for connection timeout.

  4. #4


    Thanks for the replies.

    As mentioned by stonysmith, HTTP node only provides a timeout parameter to define a caller side timeout but to handle the timeouts on client side more gracefully would need to customize the java node and handle timeouts as an exception there.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts