Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.

Commit 378fa32

Browse files
committed
chore(Backend): add try/catch to work around server-side Firebase instantiation issue
See #22
1 parent 3ea3d19 commit 378fa32

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/services/Backend.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,15 @@ export class Backend {
1313
authState: ReplaySubject<any> = new ReplaySubject(1);
1414
ref: Firebase;
1515
constructor(config: BackendConfig){
16-
this.ref = new Firebase(config.url);
16+
try {
17+
this.ref = new Firebase(config.url);
18+
} catch(e) {
19+
console.error('something went wrong', config.url, e);
20+
}
1721
}
1822
authenticate(){
1923
let authRequest = new Observable(obs => {
20-
24+
2125
this.ref.authWithOAuthPopup('github', (err, res) => {
2226
if(err){
2327
obs.error(err);
@@ -26,10 +30,10 @@ export class Backend {
2630
obs.next(res);
2731
}
2832
})
29-
33+
3034
});
31-
35+
3236
authRequest.subscribe(this.authState);
33-
37+
3438
}
3539
}

0 commit comments

Comments
 (0)