Quantcast
Channel: Processing Forum
Viewing all articles
Browse latest Browse all 1768

Re : Issues regarding to Client class

$
0
0
I assume that the sketch throws an exception when attempting to access the webserver when it is unavailable.

Java prvides the try-catch construct which will catch an exception and allow the user to decide what to do with it.

Very basic example of using this construct e.g.
  1. void setup() {
  2.   try {
  3.     // code that might throw an exception
  4.     int x = 7/0; // division by zero is not permitted
  5.   }
  6.   catch(Exception e) {
  7.     // an exception was thrown so decide what to do with it
  8.     String className =  e.getClass().getSimpleName();
  9.     println("Name of exception class: " + className);
  10.     println("Division by zero is not permitted");
  11.   }
  12. }

Viewing all articles
Browse latest Browse all 1768

Trending Articles