diff --git a/src/AddThreepid.ts b/src/AddThreepid.ts index 9549e6d08b300740c43aa30869dc34a387f595c3..9741062731dd27b47d3792462a0ba52489d9e602 100644 --- a/src/AddThreepid.ts +++ b/src/AddThreepid.ts @@ -86,6 +86,8 @@ export default class AddThreepid { } catch (err) { if (err instanceof MatrixError && err.errcode === "M_THREEPID_IN_USE") { throw new UserFriendlyError("settings|general|email_address_in_use", { cause: err }); + } else if (err instanceof MatrixError && err.errcode === "M_THREEPID_MEDIUM_NOT_SUPPORTED") { + throw new UserFriendlyError("settings|general|email_adding_unsupported_by_hs", { cause: err }); } // Otherwise, just blurt out the same error throw err; @@ -128,6 +130,8 @@ export default class AddThreepid { * @param {string} phoneCountry The ISO 2 letter code of the country to resolve phoneNumber in * @param {string} phoneNumber The national or international formatted phone number to add * @return {Promise} Resolves when the text message has been sent. Then call haveMsisdnToken(). + * + * @throws {UserFriendlyError} An appropriate user-friendly error if the verification code could not be sent. */ public async addMsisdn(phoneCountry: string, phoneNumber: string): Promise<IRequestMsisdnTokenResponse> { try { @@ -143,6 +147,8 @@ export default class AddThreepid { } catch (err) { if (err instanceof MatrixError && err.errcode === "M_THREEPID_IN_USE") { throw new UserFriendlyError("settings|general|msisdn_in_use", { cause: err }); + } else if (err instanceof MatrixError && err.errcode === "M_THREEPID_MEDIUM_NOT_SUPPORTED") { + throw new UserFriendlyError("settings|general|msisdn_adding_unsupported_by_hs", { cause: err }); } // Otherwise, just blurt out the same error throw err; diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index 8bae5b5bad9076b4fb3561c412ed72ae07dd665c..e4ca4358f8904f183ce925e054d7613f332fb52d 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -2508,6 +2508,7 @@ "discovery_needs_terms_title": "Let people find you", "display_name": "Display Name", "display_name_error": "Unable to set display name", + "email_adding_unsupported_by_hs": "This homeserver does not support adding email addresses to your account.", "email_address_in_use": "This email address is already in use", "email_address_label": "Email Address", "email_not_verified": "Your email address hasn't been verified yet", @@ -2533,6 +2534,7 @@ "identity_server_no_token": "No identity access token found", "identity_server_not_set": "Identity server not set", "language_section": "Language", + "msisdn_adding_unsupported_by_hs": "This homeserver does not support adding phone numbers to your account.", "msisdn_in_use": "This phone number is already in use", "msisdn_label": "Phone Number", "msisdn_verification_field_label": "Verification code",