[Problem/Question]
How can I catch and handle error in Sendbird UI kit? I have enabled error boundary but still I am not able to catch. Although I can see the errors in terminal.
ERROR [UIKIT_android] Couldn't send message. [SendbirdError: Invalid parameters.]
ERROR [UIKIT_android] Couldn't send message. [SendbirdError: Receiver is blocked.]
Sometimes I get connection error as well, In that case, I need to catch the error and reconnect the user.
This is how my provider looks:
const SendbirdProvider = ({ children }: { children: React.ReactNode }) => {
return (
<SendbirdUIKitContainer
appId="my-app-id"
platformServices={platformServices}
chatOptions={{
// enableImageCompression: true,
localCacheStorage,
onInitialized: (sdkInstance) => {
console.log("SENDBIRD_SDK INITIALIZED");
return sdkInstance;
},
}}
localization={{
stringSet,
}}
uikitOptions={{
groupChannel: {
enableVoiceMessage: false,
enableMention: false,
enableOgtag: false,
input: {
enableDocument: false,
camera: {
enableVideo: false,
},
gallery: {
enableVideo: false,
enablePhoto: true,
},
},
},
groupChannelList: {
enableTypingIndicator: true,
enableMessageReceiptStatus: false,
},
}}
styles={{
theme: customTheme,
}}
errorBoundary={{
disabled: false,
onError: ({ error }) => {
console.log("error handled in error errorBoundary", error);
// Analytics.logError(error); // TODO : record error in bugsnag
},
ErrorInfoComponent: ({ error, reset }) => {
return (
<LeanView>
<Text>{error.message}</Text>
<Pressable onPress={reset}>reset uikit</Pressable>
</LeanView>
);
},
}}
userProfile={{
onCreateChannel: (user) => {
// TODO : we can handle the redirect here from receive requests
console.log("onCreateChannel", user);
},
}}
>
{children}
</SendbirdUIKitContainer>
);
};
"@sendbird/chat": "^4.10.6",
"@sendbird/uikit-react-native": "^3.4.0",
[Reproduction Steps]
Straight Forward, just try to get any UIKit level error.
[Current impact]
High