Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AddDoc error not being caught #3593

Open
manuelsrleon opened this issue Dec 16, 2024 · 1 comment
Open

AddDoc error not being caught #3593

manuelsrleon opened this issue Dec 16, 2024 · 1 comment

Comments

@manuelsrleon
Copy link

manuelsrleon commented Dec 16, 2024

Good morning.

In our project, I've been trying to handle the output of an addDoc call using angular/fire. The exception will get caught but not the error thrown by addDoc. When uncommenting the line //throw "patata" the catch block will get executed.

async saveProjectTest(projectTracking: ProjectTracking) {
    const projectTrackingsRef = collection(this.firestore, 'projecttrackings');
    try{
      console.log("here1");
      //throw "patata";
      await addDoc(projectTrackingsRef, projectTracking);    
      console.log("here2");
    }catch(error){
      console.log("caught");
    };
  }

I don't know if it is a bug or what it is, but this is specially important since it seems like the appropriate way to handle connection errors and any other kinds of errors in my app. Right now I can only implement the "happy path".

I'm using Chromium v130, angularfire 18.0.1, with Angular 18.1.3, connecting to a docker container running a firebase emulator. When I want to test no connectivity, I take down the firebase container.

Thanks in advance, appreciate your help.

@google-oss-bot
Copy link

This issue does not seem to follow the issue template. Make sure you provide all the required information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants