@@ -79,6 +79,8 @@ export default class AddThreepid {
79
79
} catch ( err ) {
80
80
if ( err instanceof MatrixError && err . errcode === "M_THREEPID_IN_USE" ) {
81
81
throw new UserFriendlyError ( "settings|general|email_address_in_use" , { cause : err } ) ;
82
+ } else if ( err instanceof MatrixError && err . errcode === "M_THREEPID_MEDIUM_NOT_SUPPORTED" ) {
83
+ throw new UserFriendlyError ( "settings|general|email_adding_unsupported_by_hs" , { cause : err } ) ;
82
84
}
83
85
// Otherwise, just blurt out the same error
84
86
throw err ;
@@ -121,6 +123,8 @@ export default class AddThreepid {
121
123
* @param {string } phoneCountry The ISO 2 letter code of the country to resolve phoneNumber in
122
124
* @param {string } phoneNumber The national or international formatted phone number to add
123
125
* @return {Promise } Resolves when the text message has been sent. Then call haveMsisdnToken().
126
+ *
127
+ * @throws {UserFriendlyError } An appropriate user-friendly error if the verification code could not be sent.
124
128
*/
125
129
public async addMsisdn ( phoneCountry : string , phoneNumber : string ) : Promise < IRequestMsisdnTokenResponse > {
126
130
try {
@@ -136,6 +140,10 @@ export default class AddThreepid {
136
140
} catch ( err ) {
137
141
if ( err instanceof MatrixError && err . errcode === "M_THREEPID_IN_USE" ) {
138
142
throw new UserFriendlyError ( "settings|general|msisdn_in_use" , { cause : err } ) ;
143
+ } else if ( err instanceof MatrixError && err . errcode === "M_THREEPID_MEDIUM_NOT_SUPPORTED" ) {
144
+ throw new UserFriendlyError ( "settings|general|msisdn_adding_unsupported_by_hs" , { cause : err } ) ;
145
+ } else if ( err instanceof MatrixError && err . errcode === "M_INVALID_PARAM" ) {
146
+ throw new UserFriendlyError ( "settings|general|invalid_phone_number" , { cause : err } ) ;
139
147
}
140
148
// Otherwise, just blurt out the same error
141
149
throw err ;
0 commit comments