Skip to content

Commit

Permalink
FetchError: Show a specific message if the error is a TimeoutError.
Browse files Browse the repository at this point in the history
And add that message and the existing message to messages_en.json;
looks like we forgot to add the existing one.
  • Loading branch information
chrisbobbe committed Jun 25, 2021
1 parent 1cfabfd commit 1683743
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/chat/FetchError.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { StyleSheet, View } from 'react-native';

import type { Narrow } from '../types';
import { Label } from '../common';
import { TimeoutError } from '../utils/async';

const styles = StyleSheet.create({
container: {
Expand All @@ -28,7 +29,13 @@ export default class FetchError extends PureComponent<Props> {
render() {
return (
<View style={styles.container}>
<Label style={styles.text} text="Oops! Something went wrong." />
{(() => {
if (this.props.error instanceof TimeoutError) {
return <Label style={styles.text} text="Request timed out." />;
} else {
return <Label style={styles.text} text="Oops! Something went wrong." />;
}
})()}
</View>
);
}
Expand Down
2 changes: 2 additions & 0 deletions static/translations/messages_en.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
"Password": "Password",
"Why not start the conversation?": "Why not start the conversation?",
"That conversation doesn't seem to exist.": "That conversation doesn't seem to exist.",
"Request timed out.": "Request timed out.",
"Oops! Something went wrong.": "Oops! Something went wrong.",
"Chat": "Chat",
"Sign in with {method}": "Sign in with {method}",
"Cannot connect to server": "Cannot connect to server",
Expand Down

0 comments on commit 1683743

Please sign in to comment.