File tree Expand file tree Collapse file tree 2 files changed +6
-7
lines changed Expand file tree Collapse file tree 2 files changed +6
-7
lines changed Original file line number Diff line number Diff line change @@ -75,11 +75,8 @@ describe('blocks.*', () => {
7575 try {
7676 await call ( 'blocks.get' , { id : 'my-block' } ) ;
7777 throw new Error ( 'not this error' ) ;
78- } catch ( err ) {
79- if ( ! ( err instanceof Value ) ) throw err ;
80- const error = err . data ;
81- if ( ! ( error instanceof RpcError ) ) throw err ;
82- expect ( error . errno ) . toBe ( RpcErrorCodes . NOT_FOUND ) ;
78+ } catch ( err : any ) {
79+ expect ( err . errno ) . toBe ( RpcErrorCodes . NOT_FOUND ) ;
8380 }
8481 } ) ;
8582 } ) ;
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import {TypeRouterCaller} from '../../reactive-rpc/common/rpc/caller/TypeRouterC
55import { RpcError } from '../../reactive-rpc/common/rpc/caller' ;
66import type { Services } from '../services/Services' ;
77import type { RouteDeps } from './types' ;
8+ import { Value } from '../../reactive-rpc/common/messages/Value' ;
89
910export const createRouter = ( services : Services ) => {
1011 const system = new TypeSystem ( ) ;
@@ -18,8 +19,9 @@ export const createCaller = (services: Services) => {
1819 const caller = new TypeRouterCaller < typeof router > ( {
1920 router,
2021 wrapInternalError : ( error : unknown ) => {
21- if ( error instanceof RpcError ) console . error ( error . toJson ( ) ) ;
22- else console . error ( error ) ;
22+ if ( error instanceof Value ) return error ;
23+ if ( error instanceof RpcError ) return RpcError . value ( error ) ;
24+ console . error ( error ) ;
2325 return RpcError . valueFrom ( error ) ;
2426 } ,
2527 } ) ;
You can’t perform that action at this time.
0 commit comments