mirror of
https://github.com/processing/processing4.git
synced 2026-02-03 21:59:20 +01:00
Net: unwrap the exception if it came from the user code
This commit is contained in:
@@ -155,7 +155,12 @@ public class Client implements Runnable {
|
||||
try {
|
||||
disconnectEventMethod.invoke(parent, this);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
Throwable cause = e;
|
||||
// unwrap the exception if it came from the user code
|
||||
if (e instanceof InvocationTargetException && e.getCause() != null) {
|
||||
cause = e.getCause();
|
||||
}
|
||||
cause.printStackTrace();
|
||||
disconnectEventMethod = null;
|
||||
}
|
||||
}
|
||||
@@ -266,7 +271,12 @@ public class Client implements Runnable {
|
||||
clientEventMethod.invoke(parent, this);
|
||||
} catch (Exception e) {
|
||||
System.err.println("error, disabling clientEvent() for " + host);
|
||||
e.printStackTrace();
|
||||
Throwable cause = e;
|
||||
// unwrap the exception if it came from the user code
|
||||
if (e instanceof InvocationTargetException && e.getCause() != null) {
|
||||
cause = e.getCause();
|
||||
}
|
||||
cause.printStackTrace();
|
||||
clientEventMethod = null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -308,7 +308,12 @@ public class Server implements Runnable {
|
||||
serverEventMethod.invoke(parent, this, client);
|
||||
} catch (Exception e) {
|
||||
System.err.println("Disabling serverEvent() for port " + port);
|
||||
e.printStackTrace();
|
||||
Throwable cause = e;
|
||||
// unwrap the exception if it came from the user code
|
||||
if (e instanceof InvocationTargetException && e.getCause() != null) {
|
||||
cause = e.getCause();
|
||||
}
|
||||
cause.printStackTrace();
|
||||
serverEventMethod = null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user