@@ -138,7 +138,7 @@ export class Server {
138
138
139
139
let response : any ;
140
140
try {
141
- const proxy = this . getProxy ( proxyId ) ;
141
+ const proxy = this . getProxy ( proxyId , method ) ;
142
142
if ( typeof proxy . instance [ method ] !== "function" ) {
143
143
throw new Error ( `"${ method } " is not a function` ) ;
144
144
}
@@ -231,7 +231,7 @@ export class Server {
231
231
// It might have finished because we disposed it due to a disconnect.
232
232
if ( ! this . disconnected ) {
233
233
this . sendEvent ( proxyId , "done" ) ;
234
- this . getProxy ( proxyId ) . disposeTimeout = setTimeout ( ( ) => {
234
+ this . getProxy ( proxyId , "disposeTimeout" ) . disposeTimeout = setTimeout ( ( ) => {
235
235
instance . dispose ( ) ;
236
236
this . removeProxy ( proxyId ) ;
237
237
} , this . responseTimeout ) ;
@@ -317,7 +317,7 @@ export class Server {
317
317
* Call after disposing a proxy.
318
318
*/
319
319
private removeProxy ( proxyId : number | Module ) : void {
320
- clearTimeout ( this . getProxy ( proxyId ) . disposeTimeout as any ) ;
320
+ clearTimeout ( this . getProxy ( proxyId , "disposeTimeout" ) . disposeTimeout as any ) ;
321
321
this . proxies . delete ( proxyId ) ;
322
322
323
323
logger . trace ( ( ) => [
@@ -331,9 +331,9 @@ export class Server {
331
331
return stringify ( value , undefined , ( p ) => this . storeProxy ( p ) ) ;
332
332
}
333
333
334
- private getProxy ( proxyId : number | Module ) : ProxyData {
334
+ private getProxy ( proxyId : number | Module , method : string ) : ProxyData {
335
335
if ( ! this . proxies . has ( proxyId ) ) {
336
- throw new Error ( `proxy ${ proxyId } disposed too early ` ) ;
336
+ throw new Error ( `Cannot run " ${ method } " on proxy ${ proxyId } : proxy does not exist ` ) ;
337
337
}
338
338
339
339
return this . proxies . get ( proxyId ) ! ;
0 commit comments