Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3303323
D11893.id39827.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D11893.id39827.diff
View Options
diff --git a/native/community-settings/tag-farcaster-channel/tag-farcaster-channel-by-name.react.js b/native/community-settings/tag-farcaster-channel/tag-farcaster-channel-by-name.react.js
--- a/native/community-settings/tag-farcaster-channel/tag-farcaster-channel-by-name.react.js
+++ b/native/community-settings/tag-farcaster-channel/tag-farcaster-channel-by-name.react.js
@@ -17,6 +17,11 @@
import type { NavigationRoute } from '../../navigation/route-names.js';
import { useStyles, useColors } from '../../themes/colors.js';
+const errorMessages: { +[string]: string } = {
+ already_in_use: 'This Farcaster channel is already tagged to a community.',
+ channel_not_found: 'Cannot find a channel with the provided name.',
+};
+
export type TagFarcasterChannelByNameParams = {
+communityID: string,
};
@@ -37,6 +42,7 @@
const [channelSelectionText, setChannelSelectionText] =
React.useState<string>('');
+ const [error, setError] = React.useState<?string>(null);
const neynarClientContext = React.useContext(NeynarClientContext);
invariant(neynarClientContext, 'NeynarClientContext is missing');
@@ -54,8 +60,7 @@
farcasterChannelID: channelID,
});
} catch (e) {
- // TODO: Improve error handling
- console.log(e.message);
+ setError(e.message);
throw e;
}
},
@@ -69,7 +74,7 @@
);
if (!channelInfo) {
- // TODO: Improve error handling
+ setError('channel_not_found');
return;
}
@@ -87,6 +92,18 @@
neynarClientContext.client,
]);
+ const errorMessage = React.useMemo(() => {
+ if (!error) {
+ return null;
+ }
+
+ return (
+ <Text style={styles.error}>
+ {errorMessages[error] ?? 'Unknown error.'}
+ </Text>
+ );
+ }, [error, styles.error]);
+
const submitButtonVariant =
channelSelectionText.length > 0 ? 'enabled' : 'disabled';
@@ -105,6 +122,7 @@
autoCapitalize="none"
/>
</View>
+ {errorMessage}
<View style={styles.buttonContainer}>
<RegistrationButton
onPress={onPressTagChannel}
@@ -149,6 +167,14 @@
color: 'panelForegroundLabel',
fontSize: 16,
},
+ error: {
+ fontSize: 12,
+ fontWeight: '400',
+ lineHeight: 18,
+ textAlign: 'center',
+ color: 'redText',
+ marginTop: 8,
+ },
buttonContainer: {
marginTop: 16,
},
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Nov 19, 11:33 AM (21 h, 3 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2537870
Default Alt Text
D11893.id39827.diff (2 KB)
Attached To
Mode
D11893: [native] improve error handling for TagUnfollowedFarcasterChannel screen
Attached
Detach File
Event Timeline
Log In to Comment