@@ -95,23 +95,23 @@ export class OnboardingWebviewController implements WebviewController<SectionCha
95
95
}
96
96
case OnboardingActionType . Login : {
97
97
let isCloud = true ;
98
- if ( isBasicAuthInfo ( msg . authInfo ) ) {
99
- isCloud = false ;
100
- try {
98
+ this . _analytics . fireAuthenticateButtonEvent ( id , msg . siteInfo , isCloud ) ;
99
+ try {
100
+ if ( isBasicAuthInfo ( msg . authInfo ) ) {
101
+ isCloud = false ;
101
102
await this . _api . authenticateServer ( msg . siteInfo , msg . authInfo ) ;
102
- } catch ( e ) {
103
- const err = new Error ( `Authentication error: ${ e } ` ) ;
104
- this . _logger . error ( err ) ;
105
- this . postMessage ( {
106
- type : CommonMessageType . Error ,
107
- reason : formatError ( e , 'Authentication error' ) ,
108
- } ) ;
103
+ } else {
104
+ await this . _api . authenticateCloud ( msg . siteInfo , this . _onboardingUrl ) ;
109
105
}
110
- } else {
111
- await this . _api . authenticateCloud ( msg . siteInfo , this . _onboardingUrl ) ;
106
+ this . postMessage ( { type : OnboardingMessageType . LoginResponse } ) ;
107
+ } catch ( e ) {
108
+ const env = isCloud ? 'cloud' : 'server' ;
109
+ this . _logger . error ( new Error ( `${ env } onboarding authentication error: ${ e } ` ) ) ;
110
+ this . postMessage ( {
111
+ type : CommonMessageType . Error ,
112
+ reason : formatError ( e , `${ env } onboarding authentication error` ) ,
113
+ } ) ;
112
114
}
113
- this . postMessage ( { type : OnboardingMessageType . LoginResponse } ) ;
114
- this . _analytics . fireAuthenticateButtonEvent ( id , msg . siteInfo , isCloud ) ;
115
115
break ;
116
116
}
117
117
case OnboardingActionType . SaveSettings : {
0 commit comments