diff --git a/lib/shared/farcaster/farcaster-api.js b/lib/shared/farcaster/farcaster-api.js --- a/lib/shared/farcaster/farcaster-api.js +++ b/lib/shared/farcaster/farcaster-api.js @@ -28,6 +28,11 @@ assertWithValidator, } from '../../utils/validation-utils.js'; +export const notAuthorizedToViewPendingInvitesError = + 'Not authorized to view pending invites'; +export const notAuthorizedToAccessConversationError = + 'Not authorized to access this conversation'; + export type SendFarcasterTextMessageInput = | { +groupId: string, @@ -387,13 +392,20 @@ ); return result; } catch (error) { + const message = getMessageForException(error); + const isError = !message?.includes( + notAuthorizedToViewPendingInvitesError, + ); + const logType = isError + ? [logTypes.FARCASTER, logTypes.ERROR] + : [logTypes.FARCASTER]; addLog( 'Farcaster API: Failed to fetch conversation invites', JSON.stringify({ conversationId: input.conversationId, error: getMessageForException(error), }), - new Set([logTypes.FARCASTER, logTypes.ERROR]), + new Set(logType), ); throw error; } diff --git a/lib/shared/farcaster/farcaster-hooks.js b/lib/shared/farcaster/farcaster-hooks.js --- a/lib/shared/farcaster/farcaster-hooks.js +++ b/lib/shared/farcaster/farcaster-hooks.js @@ -13,6 +13,8 @@ type FetchFarcasterConversationInvitesInput, type FetchFarcasterConversationInvitesResult, type FetchFarcasterConversationResult, + notAuthorizedToViewPendingInvitesError, + notAuthorizedToAccessConversationError, useFetchFarcasterConversation, useFetchFarcasterConversationInvites, useFetchFarcasterInbox, @@ -223,8 +225,8 @@ } const notRetryableErrors = [ - 'Not authorized to view pending invites', - 'Not authorized to access this conversation', + notAuthorizedToViewPendingInvitesError, + notAuthorizedToAccessConversationError, ]; async function withRetry( @@ -419,7 +421,7 @@ } catch (error) { const messageForException = getMessageForException(error); if ( - messageForException?.includes('Not authorized to view pending invites') + messageForException?.includes(notAuthorizedToViewPendingInvitesError) ) { // This is normal for many Farcaster group conversations return null; @@ -483,15 +485,6 @@ conversationInviteesResult?.result?.invites ?? [], ); const fids = thread.members.map(member => member.id); - - if (fids.length === 0 && addLog) { - addLog( - 'Farcaster: No members (FIDs) found in conversation', - JSON.stringify({ conversationID }), - new Set([logTypes.FARCASTER]), - ); - } - const commFCUsersForFIDs = await fetchUsersByFIDs(fids); if (commFCUsersForFIDs.size !== fids.length && addLog) {