@@ -12,6 +12,7 @@ import { distinctUntilChanged, map, skip } from 'rxjs';
12
12
13
13
import type { UrlService } from '../../url' ;
14
14
import { type AuthAccountInfo , AuthSession } from '../entities/session' ;
15
+ import { BackendError } from '../error' ;
15
16
import type { AuthStore } from '../stores/auth' ;
16
17
import type { FetchService } from './fetch' ;
17
18
@@ -111,7 +112,10 @@ export class AuthService extends Service {
111
112
} ,
112
113
} ) ;
113
114
} catch ( e ) {
114
- track . $ . $ . auth . signInFail ( { method : 'magic-link' } ) ;
115
+ track . $ . $ . auth . signInFail ( {
116
+ method : 'magic-link' ,
117
+ reason : e instanceof BackendError ? e . originError . type : 'unknown' ,
118
+ } ) ;
115
119
throw e ;
116
120
}
117
121
}
@@ -129,7 +133,10 @@ export class AuthService extends Service {
129
133
this . session . revalidate ( ) ;
130
134
track . $ . $ . auth . signedIn ( { method : 'magic-link' } ) ;
131
135
} catch ( e ) {
132
- track . $ . $ . auth . signInFail ( { method : 'magic-link' } ) ;
136
+ track . $ . $ . auth . signInFail ( {
137
+ method : 'magic-link' ,
138
+ reason : e instanceof BackendError ? e . originError . type : 'unknown' ,
139
+ } ) ;
133
140
throw e ;
134
141
}
135
142
}
@@ -166,7 +173,11 @@ export class AuthService extends Service {
166
173
167
174
return url ;
168
175
} catch ( e ) {
169
- track . $ . $ . auth . signInFail ( { method : 'oauth' , provider } ) ;
176
+ track . $ . $ . auth . signInFail ( {
177
+ method : 'oauth' ,
178
+ provider,
179
+ reason : e instanceof BackendError ? e . originError . type : 'unknown' ,
180
+ } ) ;
170
181
throw e ;
171
182
}
172
183
}
@@ -186,7 +197,11 @@ export class AuthService extends Service {
186
197
track . $ . $ . auth . signedIn ( { method : 'oauth' , provider } ) ;
187
198
return res . json ( ) ;
188
199
} catch ( e ) {
189
- track . $ . $ . auth . signInFail ( { method : 'oauth' , provider } ) ;
200
+ track . $ . $ . auth . signInFail ( {
201
+ method : 'oauth' ,
202
+ provider,
203
+ reason : e instanceof BackendError ? e . originError . type : 'unknown' ,
204
+ } ) ;
190
205
throw e ;
191
206
}
192
207
}
@@ -212,7 +227,10 @@ export class AuthService extends Service {
212
227
this . session . revalidate ( ) ;
213
228
track . $ . $ . auth . signedIn ( { method : 'password' } ) ;
214
229
} catch ( e ) {
215
- track . $ . $ . auth . signInFail ( { method : 'password' } ) ;
230
+ track . $ . $ . auth . signInFail ( {
231
+ method : 'password' ,
232
+ reason : e instanceof BackendError ? e . originError . type : 'unknown' ,
233
+ } ) ;
216
234
throw e ;
217
235
}
218
236
}
0 commit comments