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
1 changed files with 9 additions and 1 deletions

View File

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