1
0
mirror of https://github.com/bitwarden/browser synced 2024-12-25 17:32:46 +01:00

catch fastmail errors in notCreated response prop (#3395)

This commit is contained in:
Kyle Spearrin 2022-08-26 19:01:00 -04:00 committed by GitHub
parent 33af940515
commit 231e1bf666
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -54,7 +54,15 @@ export class FastmailForwarder implements Forwarder {
json.methodResponses[0].length > 0
) {
if (json.methodResponses[0][0] === "MaskedEmail/set") {
return json.methodResponses[0][1]?.created?.["new-masked-email"]?.email;
if (json.methodResponses[0][1]?.created?.["new-masked-email"] != null) {
return json.methodResponses[0][1]?.created?.["new-masked-email"]?.email;
}
if (json.methodResponses[0][1]?.notCreated?.["new-masked-email"] != null) {
throw (
"Fastmail error: " +
json.methodResponses[0][1]?.notCreated?.["new-masked-email"]?.description
);
}
} else if (json.methodResponses[0][0] === "error") {
throw "Fastmail error: " + json.methodResponses[0][1]?.description;
}