@@ -61,23 +61,23 @@ export interface EventOptions<Remote> {
6161 /**
6262 * Custom error handler
6363 *
64- * @deprecated use `onRemoteError ` and `onLocalError ` instead
64+ * @deprecated use `onFunctionError ` and `onGeneralError ` instead
6565 */
6666 onError ?: ( error : Error , functionName : string , args : any [ ] ) => boolean | void
6767
6868 /**
69- * Custom error handler for errors occurred in remote functions
69+ * Custom error handler for errors occurred in local functions being called
7070 *
7171 * @returns `true` to prevent the error from being thrown
7272 */
73- onRemoteError ?: ( error : Error , functionName : string , args : any [ ] ) => boolean | void
73+ onFunctionError ?: ( error : Error , functionName : string , args : any [ ] ) => boolean | void
7474
7575 /**
76- * Custom error handler for errors occurred in local functions or during serialization
76+ * Custom error handler for errors occurred during serialization or messsaging
7777 *
7878 * @returns `true` to prevent the error from being thrown
7979 */
80- onLocalError ?: ( error : Error , functionName ?: string , args ?: any [ ] ) => boolean | void
80+ onGeneralError ?: ( error : Error , functionName ?: string , args ?: any [ ] ) => boolean | void
8181
8282 /**
8383 * Custom error handler for timeouts
@@ -282,7 +282,7 @@ export function createBirpc<RemoteFunctions = Record<string, never>, LocalFuncti
282282 msg = deserialize ( data ) as RPCMessage
283283 }
284284 catch ( e ) {
285- if ( options . onLocalError ?.( e as Error ) !== true )
285+ if ( options . onGeneralError ?.( e as Error ) !== true )
286286 throw e
287287 return
288288 }
@@ -310,8 +310,8 @@ export function createBirpc<RemoteFunctions = Record<string, never>, LocalFuncti
310310 // Error handling
311311 if ( error && options . onError )
312312 options . onError ( error , method , args )
313- if ( error && options . onRemoteError ) {
314- if ( options . onRemoteError ( error , method , args ) === true )
313+ if ( error && options . onFunctionError ) {
314+ if ( options . onFunctionError ( error , method , args ) === true )
315315 return
316316 }
317317
@@ -323,7 +323,7 @@ export function createBirpc<RemoteFunctions = Record<string, never>, LocalFuncti
323323 }
324324 catch ( e ) {
325325 error = e
326- if ( options . onLocalError ?.( e as Error , method , args ) !== true )
326+ if ( options . onGeneralError ?.( e as Error , method , args ) !== true )
327327 throw e
328328 }
329329 }
@@ -332,7 +332,7 @@ export function createBirpc<RemoteFunctions = Record<string, never>, LocalFuncti
332332 post ( serialize ( < Response > { t : TYPE_RESPONSE , i : msg . i , e : error } ) , ...extra )
333333 }
334334 catch ( e ) {
335- if ( options . onLocalError ?.( e as Error , method , args ) !== true )
335+ if ( options . onGeneralError ?.( e as Error , method , args ) !== true )
336336 throw e
337337 }
338338 }
0 commit comments