From caa3a388f8c83370f852e4370ea03c7d9112ff1a Mon Sep 17 00:00:00 2001 From: Mats Auraot Date: Fri, 10 Nov 2023 12:40:14 +0100 Subject: [PATCH] Log errors thrown by implementations (#8) --- .../pixelib/meteor/core/transport/TransportHandler.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/meteor-core/src/main/java/dev/pixelib/meteor/core/transport/TransportHandler.java b/meteor-core/src/main/java/dev/pixelib/meteor/core/transport/TransportHandler.java index 5c2bbd1..9b1ecf7 100644 --- a/meteor-core/src/main/java/dev/pixelib/meteor/core/transport/TransportHandler.java +++ b/meteor-core/src/main/java/dev/pixelib/meteor/core/transport/TransportHandler.java @@ -14,9 +14,12 @@ import java.util.Collection; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; +import java.util.logging.Level; +import java.util.logging.Logger; public class TransportHandler implements Closeable { + private final Logger logger = Logger.getLogger(TransportHandler.class.getSimpleName()); private final RpcSerializer serializer; private final RpcTransport transport; private final IncomingInvocationTracker incomingInvocationTracker; @@ -91,8 +94,8 @@ private boolean handleInvocationRequest(byte[] bytes) throws ClassNotFoundExcept Object response = matchedImplementation.invokeOn(invocationDescriptor, invocationDescriptor.getReturnType()); InvocationResponse invocationResponse = new InvocationResponse(invocationDescriptor.getUniqueInvocationId(), response); transport.send(Direction.METHOD_PROXY, invocationResponse.toBytes(serializer)); - } catch (NoSuchMethodException e) { - e.printStackTrace(); + } catch (Throwable e) { + logger.log(Level.SEVERE, "An error occurred while invoking a method", e); } });