Skip to content

Commit

Permalink
fix(package): added try and catch block for the handling success asyn…
Browse files Browse the repository at this point in the history
…c method
  • Loading branch information
AnthonyNahas committed Dec 21, 2018
1 parent 5bc641c commit 2bc3ed9
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/module/services/auth-process.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export class AuthProcessService implements ISignInProcess, ISignUpProcess {
public async signInWith(provider: AuthProvider, email?: string, password?: string) {
try {
this.isLoading = true;
let signInResult: UserCredential;
let signInResult: UserCredential | any;

switch (provider) {
case AuthProvider.ANONYMOUS:
Expand Down Expand Up @@ -210,7 +210,11 @@ export class AuthProcessService implements ISignInProcess, ISignUpProcess {

async handleSuccess(userCredential: UserCredential) {
if (this.config.enableFirestoreSync) {
await this._fireStoreService.updateUserData(this.parseUserInfo(userCredential.user));
try {
await this._fireStoreService.updateUserData(this.parseUserInfo(userCredential.user));
} catch (e) {
console.error(`Error occurred while updating user data with firestore: ${e}`);
}
}

if (this.config.toastMessageOnAuthSuccess) {
Expand Down

0 comments on commit 2bc3ed9

Please sign in to comment.