@@ -4,7 +4,7 @@ import { computed, observable, action, autorun, flow, runInAction } from 'mobx';
44import { observer , inject , disposeOnUnmount } from 'mobx-react' ;
55
66import { delay } from '../../../util/promise' ;
7- import { UnreachableCheck } from '../../../util/error' ;
7+ import { ErrorLike , UnreachableCheck } from '../../../util/error' ;
88import { styled } from '../../../styles' ;
99import { Icon } from '../../../icons' ;
1010
@@ -16,6 +16,7 @@ import { RulesStore } from '../../../model/rules/rules-store';
1616import { FridaActivationOptions , FridaHost , FridaTarget } from '../../../model/interception/frida' ;
1717
1818import { getDetailedInterceptorMetadata } from '../../../services/server-api' ;
19+ import { ActivationFailure } from '../../../services/server-api-types' ;
1920
2021import { TextInput } from '../../common/inputs' ;
2122import { InterceptionTargetList } from './intercept-target-list' ;
@@ -162,6 +163,16 @@ const INCOMPATIBLE_APP_IDS: string[] = [
162163 "com.google.android.googlequicksearchbox"
163164] ;
164165
166+ const alertActivationError = ( action : string , error : ErrorLike ) => {
167+ if ( error instanceof ActivationFailure ) {
168+ alert ( `Failed to ${ action } : ${ error . failureMessage } (${ error . errorCode } )` ) ;
169+ } else {
170+ alert ( `Failed to ${ action } : ${ error . message ?? error } ` ) ;
171+ }
172+
173+ throw error ;
174+ } ;
175+
165176@inject ( 'proxyStore' )
166177@inject ( 'rulesStore' )
167178@inject ( 'eventsStore' )
@@ -319,7 +330,7 @@ class FridaConfig extends React.Component<{
319330 await this . props . activateInterceptor ( {
320331 action : 'setup' ,
321332 hostId
322- } ) ;
333+ } ) . catch ( ( e ) => alertActivationError ( 'setup Frida' , e ) ) ;
323334
324335 this . setHostProgress ( hostId , 75 ) ;
325336 await this . launchInterceptor ( hostId ) ;
@@ -343,7 +354,7 @@ class FridaConfig extends React.Component<{
343354 await this . props . activateInterceptor ( {
344355 action : 'launch' ,
345356 hostId
346- } ) ;
357+ } ) . catch ( ( e ) => alertActivationError ( 'launch Frida' , e ) ) ;
347358
348359 this . setHostProgress ( hostId , 100 ) ;
349360 await delay ( 10 ) ; // Tiny delay, purely for nice UI purposes
@@ -374,7 +385,9 @@ class FridaConfig extends React.Component<{
374385 action : 'intercept' ,
375386 hostId : host . id ,
376387 targetId
377- } ) . then ( ( ) => {
388+ } )
389+ . catch ( ( e ) => alertActivationError ( `intercept ${ targetId } ` , e ) )
390+ . then ( ( ) => {
378391 this . props . reportSuccess ( ) ;
379392 } ) . finally ( action ( ( ) => {
380393 _ . pull ( this . inProgressTargetIds , targetId ) ;
0 commit comments