]> nmode's Git Repositories - signal-cli/blobdiff - src/main/java/org/asamk/signal/jsonrpc/SignalJsonRpcCommandHandler.java
Replace deprecated DBusMap
[signal-cli] / src / main / java / org / asamk / signal / jsonrpc / SignalJsonRpcCommandHandler.java
index 3d4708200434c4aa1a6db9cc4d84b3b4fafc4650..96456a4edda31b2585d84fd87825e867a36d25e2 100644 (file)
@@ -94,7 +94,7 @@ public class SignalJsonRpcCommandHandler {
             if (manager == null) {
                 final var managers = c.getManagers();
                 if (managers.size() == 1) {
-                    manager = managers.get(0);
+                    manager = managers.getFirst();
                 }
             }
             if (manager != null) {
@@ -229,15 +229,17 @@ public class SignalJsonRpcCommandHandler {
                 case RateLimitErrorException e -> throw new JsonRpcException(new JsonRpcResponse.Error(RATELIMIT_ERROR,
                         e.getMessage(),
                         getErrorDataNode(objectMapper, result)));
-                case UnexpectedErrorException e ->
-                        throw new JsonRpcException(new JsonRpcResponse.Error(JsonRpcResponse.Error.INTERNAL_ERROR,
-                                e.getMessage(),
-                                getErrorDataNode(objectMapper, result)));
+                case UnexpectedErrorException e -> {
+                    logger.error("Command execution failed with unexpected error", e);
+                    throw new JsonRpcException(new JsonRpcResponse.Error(JsonRpcResponse.Error.INTERNAL_ERROR,
+                            e.getMessage() + " (" + e.getClass().getSimpleName() + ")",
+                            getErrorDataNode(objectMapper, result)));
+                }
             }
         } catch (Throwable e) {
             logger.error("Command execution failed", e);
             throw new JsonRpcException(new JsonRpcResponse.Error(JsonRpcResponse.Error.INTERNAL_ERROR,
-                    e.getMessage(),
+                    e.getMessage() + " (" + e.getClass().getSimpleName() + ")",
                     getErrorDataNode(objectMapper, result)));
         }