AddDoc error not being caught
- 主要言語
- TypeScript
- スター
- 7.8k
- フォーク
- 2.2k
- 平均マージ
- 22時間 28分
- マージ済み PR(30日)
- 6
説明
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.
コントリビューションガイド
調査の方向性
指定された AngularFire と Firestore エミュレーターのバージョンを使用して、saveProjectTest エントリーポイントとその await addDoc 呼び出しから始めます。Firebase コンテナを停止した状態でケースを再現し、addDoc の失敗と明示的な throw を比較して、想定されたエラーが catch ブロックに到達するか確認します。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- angular, firebase, typescript
- 領域
- databases
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100