|
|
|
|
@ -23,7 +23,7 @@ impl UserFacingError for HttpError {
|
|
|
|
|
HttpError::Reqwest(error) => { |
|
|
|
|
// TODO: Add more information based on the error
|
|
|
|
|
if error.is_timeout() { |
|
|
|
|
gettext("The connection timed out. Try again later.") |
|
|
|
|
gettext("Connection timed out.") |
|
|
|
|
} else { |
|
|
|
|
gettext("Could not connect to the homeserver.") |
|
|
|
|
} |
|
|
|
|
@ -35,8 +35,8 @@ impl UserFacingError for HttpError {
|
|
|
|
|
}, |
|
|
|
|
))) => { |
|
|
|
|
match kind { |
|
|
|
|
Forbidden { .. } => gettext("The provided username or password is invalid."), |
|
|
|
|
UserDeactivated => gettext("The account is deactivated."), |
|
|
|
|
Forbidden { .. } => gettext("Invalid credentials."), |
|
|
|
|
UserDeactivated => gettext("Account deactivated."), |
|
|
|
|
LimitExceeded { retry_after } => { |
|
|
|
|
if let Some(retry_after) = retry_after { |
|
|
|
|
let duration = match retry_after { |
|
|
|
|
@ -52,13 +52,13 @@ impl UserFacingError for HttpError {
|
|
|
|
|
ngettext_f( |
|
|
|
|
// Translators: Do NOT translate the content between '{' and '}',
|
|
|
|
|
// this is a variable name.
|
|
|
|
|
"You exceeded the homeserver’s rate limit, retry in 1 second.", |
|
|
|
|
"You exceeded the homeserver’s rate limit, retry in {n} seconds.", |
|
|
|
|
"Rate limit exceeded, retry in 1 second.", |
|
|
|
|
"Rate limit exceeded, retry in {n} seconds.", |
|
|
|
|
secs, |
|
|
|
|
&[("n", &secs.to_string())], |
|
|
|
|
) |
|
|
|
|
} else { |
|
|
|
|
gettext("You exceeded the homeserver’s rate limit, try again later.") |
|
|
|
|
gettext("Rate limit exceeded, try again later.") |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
_ => { |
|
|
|
|
@ -68,7 +68,7 @@ impl UserFacingError for HttpError {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
_ => gettext("An unexpected connection error occurred."), |
|
|
|
|
_ => gettext("Unexpected connection error."), |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
@ -78,7 +78,7 @@ impl UserFacingError for Error {
|
|
|
|
|
match self { |
|
|
|
|
Error::DecryptorError(_) => gettext("Could not decrypt the event."), |
|
|
|
|
Error::Http(http_error) => http_error.to_user_facing(), |
|
|
|
|
_ => gettext("An unexpected error occurred."), |
|
|
|
|
_ => gettext("Unexpected error."), |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
@ -86,13 +86,11 @@ impl UserFacingError for Error {
|
|
|
|
|
impl UserFacingError for ClientBuildError { |
|
|
|
|
fn to_user_facing(&self) -> String { |
|
|
|
|
match self { |
|
|
|
|
ClientBuildError::Url(_) => gettext("This is not a valid URL."), |
|
|
|
|
ClientBuildError::AutoDiscovery(_) => { |
|
|
|
|
gettext("Homeserver auto-discovery failed. Try entering the full URL manually.") |
|
|
|
|
} |
|
|
|
|
ClientBuildError::Url(_) => gettext("Invalid URL."), |
|
|
|
|
ClientBuildError::AutoDiscovery(_) => gettext("Could not discover homeserver."), |
|
|
|
|
ClientBuildError::Http(err) => err.to_user_facing(), |
|
|
|
|
ClientBuildError::SqliteStore(_) => gettext("Could not open the store."), |
|
|
|
|
_ => gettext("An unexpected error occurred."), |
|
|
|
|
_ => gettext("Unexpected error."), |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|