Skip to content

Commit d18619f

Browse files
jmoseleyCopilot
andcommitted
Reply with canvas error when canvas callback fails synchronously
Address Cloud Code Review feedback: the canvas.open / canvas.close / canvas.action.invoke handlers caught synchronous failures (e.g. malformed params from treeToValue, or any logic before the CompletableFuture chain is attached) but only logged them, leaving the caller without a response. Send a structured canvas error reply in the catch block so the provider callback always completes instead of hanging. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
1 parent 03501b3 commit d18619f

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

java/src/main/java/com/github/copilot/RpcHandlerDispatcher.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -498,6 +498,7 @@ private void handleCanvasOpen(JsonRpcClient rpc, String requestId, JsonNode para
498498
});
499499
} catch (Exception e) {
500500
LOG.log(Level.SEVERE, "Error handling canvas open request", e);
501+
sendCanvasError(rpc, requestIdLong, "canvas.open", e);
501502
}
502503
});
503504
}
@@ -527,6 +528,7 @@ private void handleCanvasClose(JsonRpcClient rpc, String requestId, JsonNode par
527528
});
528529
} catch (Exception e) {
529530
LOG.log(Level.SEVERE, "Error handling canvas close request", e);
531+
sendCanvasError(rpc, requestIdLong, "canvas.close", e);
530532
}
531533
});
532534
}
@@ -556,6 +558,7 @@ private void handleCanvasActionInvoke(JsonRpcClient rpc, String requestId, JsonN
556558
});
557559
} catch (Exception e) {
558560
LOG.log(Level.SEVERE, "Error handling canvas action invoke request", e);
561+
sendCanvasError(rpc, requestIdLong, "canvas.action.invoke", e);
559562
}
560563
});
561564
}

0 commit comments

Comments
 (0)