File tree Expand file tree Collapse file tree 2 files changed +5
-1
lines changed Expand file tree Collapse file tree 2 files changed +5
-1
lines changed Original file line number Diff line number Diff line change 33 CancelledNotificationSchema ,
44 ClientCapabilities ,
55 ErrorCode ,
6+ isJSONRPCError ,
67 isJSONRPCRequest ,
78 isJSONRPCResponse ,
89 isJSONRPCNotification ,
@@ -274,7 +275,7 @@ export abstract class Protocol<
274275 } ;
275276
276277 this . _transport . onmessage = ( message ) => {
277- if ( isJSONRPCResponse ( message ) ) {
278+ if ( isJSONRPCResponse ( message ) || isJSONRPCError ( message ) ) {
278279 this . _onresponse ( message ) ;
279280 } else if ( isJSONRPCRequest ( message ) ) {
280281 this . _onrequest ( message ) ;
Original file line number Diff line number Diff line change @@ -150,6 +150,9 @@ export const JSONRPCErrorSchema = z
150150 } )
151151 . strict ( ) ;
152152
153+ export const isJSONRPCError = ( value : unknown ) : value is JSONRPCError =>
154+ JSONRPCErrorSchema . safeParse ( value ) . success ;
155+
153156export const JSONRPCMessageSchema = z . union ( [
154157 JSONRPCRequestSchema ,
155158 JSONRPCNotificationSchema ,
You can’t perform that action at this time.
0 commit comments