File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -47,13 +47,21 @@ const buildResolvers = (interceptors: _.Dictionary<Interceptor>) => {
4747 Mutation : {
4848 activateInterceptor : async ( __ : void , args : _ . Dictionary < any > ) => {
4949 const { id, proxyPort, options } = args ;
50- await interceptors [ id ] . activate ( proxyPort , options ) ;
51- return interceptors [ id ] . isActive ( proxyPort ) ;
50+
51+ const interceptor = interceptors [ id ] ;
52+ if ( ! interceptor ) throw new Error ( `Unknown interceptor ${ id } ` ) ;
53+
54+ await interceptor . activate ( proxyPort , options ) ;
55+ return interceptor . isActive ( proxyPort ) ;
5256 } ,
5357 deactivateInterceptor : async ( __ : void , args : _ . Dictionary < any > ) => {
5458 const { id, proxyPort, options } = args ;
55- await interceptors [ id ] . deactivate ( proxyPort , options ) ;
56- return ! interceptors [ id ] . isActive ( proxyPort ) ;
59+
60+ const interceptor = interceptors [ id ] ;
61+ if ( ! interceptor ) throw new Error ( `Unknown interceptor ${ id } ` ) ;
62+
63+ await interceptor . deactivate ( proxyPort , options ) ;
64+ return ! interceptor . isActive ( proxyPort ) ;
5765 }
5866 } ,
5967
You can’t perform that action at this time.
0 commit comments