angular / angular/angularfire

createUserWithEmailAndPassword exception propagates to global handler

Open
#3,129 3 comments 4 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
7.8k
Forks
2.2k
Avg merge
22h 28m
Merged PRs (30d)
6

Description

### Version info

**Angular:**
angular/core: "~13.1.0",

**Firebase:**
"firebase": "^9.6.3",

**AngularFire:**
angular/fire: "^7.2.0",

**Other (e.g. Ionic/Cordova, Node, browser, operating system):**
Windows 10, Node.js v16.13.2., Edge and Chrome, latest version

### How to reproduce these conditions
Using the ``compat`` layer

```
import {AngularFireAuth} from '@angular/fire/compat/auth';
// etc

// choose an email address that is already in use, this throws the exception auth/email-already-in-use as expected
this.angularFireAuth.createUserWithEmailAndPassword(email, passwd).then((userCredential) => {
// user create was successful
}).catch((error) => {
console.log(error);
// even though we catch auth/email-already-in-use
// the error still propagates to the global error handler
// and appears on the console
// see the screenshot
});
```

See [this thread on stackoverflow where the question was asked already](https://stackoverflow.com/questions/67580158/cant-catch-exception-in-angularfireauth)

** Screenshots **
image

### Expected behavior

The exception that is caught in the catch block should not make its way to the global error handler

### Actual behavior

The exception that we caught in the catch block still propagates up to the global error handler

Contributor guide

Open the contributing guide

Research direction

Start at the @angular/fire/compat/auth entry point and reproduce the issue with createUserWithEmailAndPassword using an already-registered email. Trace the caught auth/email-already-in-use error and compare the promise catch behavior with the global error handler. Done means the caught exception no longer reaches the global handler or console.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, firebase, typescript
Domain
authentication, frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.