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>) => {
47
47
Mutation : {
48
48
activateInterceptor : async ( __ : void , args : _ . Dictionary < any > ) => {
49
49
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 ) ;
52
56
} ,
53
57
deactivateInterceptor : async ( __ : void , args : _ . Dictionary < any > ) => {
54
58
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 ) ;
57
65
}
58
66
} ,
59
67
You can’t perform that action at this time.
0 commit comments