我有一個firebase函數,其中我手動拋出一個錯誤,其中包含如下狀態和消息:throw new functions.https.HttpsError('permission-denied', 'Token does not match');我從服務器獲得的響應如下所示(使用chrome dev控制臺):{"error":{"message":"Token does not match","status":"PERMISSION_DENIED"}}但是當我像這樣調用函數時,錯誤中沒有狀態(使用AngularFire2):try { return await this.functions.httpsCallable<void, void>('testFunc')().toPromise();} catch (e) { console.log(e.name); // "Error" console.log(e.message); // "Token does not match" console.log(e.status); // undefined}有沒有辦法獲得它的狀態,因為我寧愿檢查而不是.if(e.status == 'PERMISSION_DENIED')if(e.message == 'Token does not match')
你能讀懂火庫函數的 HttpsError 狀態嗎?
慕妹3146593
2022-08-18 15:31:46