fix: improve error messaging for various components to provide clearer feedback on failures

This commit is contained in:
Usman Baig
2026-02-22 19:17:20 +01:00
parent ac6a9429d4
commit 156d9986df
15 changed files with 25 additions and 24 deletions

View File

@@ -205,7 +205,7 @@ export default function PricingSection() {
} catch (error: any) {
console.error('Checkout error:', error)
toast.error('Failed to start checkout. Please try again.')
toast.error('Failed to start checkout — please try again')
} finally {
setLoadingPlan(null)
}

View File

@@ -248,7 +248,7 @@ export default function OrganizationSettings() {
setAuditTotal(typeof total === 'number' ? total : 0)
} catch (error) {
console.error('Failed to load audit log', error)
toast.error(getAuthErrorMessage(error as Error) || 'Failed to load audit log')
toast.error(getAuthErrorMessage(error as Error) || 'Failed to load audit log entries')
} finally {
setIsLoadingAudit(false)
}
@@ -333,7 +333,7 @@ export default function OrganizationSettings() {
const { url } = await createPortalSession()
window.location.href = url
} catch (error: any) {
toast.error(getAuthErrorMessage(error) || error.message || 'Failed to redirect to billing portal')
toast.error(getAuthErrorMessage(error) || error.message || 'Failed to open billing portal')
setIsRedirectingToPortal(false)
}
}
@@ -398,7 +398,7 @@ export default function OrganizationSettings() {
else throw new Error('No checkout URL')
}
} catch (error: any) {
toast.error(getAuthErrorMessage(error) || error.message || 'Something went wrong.')
toast.error(getAuthErrorMessage(error) || error.message || 'Failed to update member role')
} finally {
setIsChangingPlan(false)
}
@@ -484,7 +484,7 @@ export default function OrganizationSettings() {
setIsEditing(false)
loadMembers()
} catch (error: any) {
toast.error(getAuthErrorMessage(error) || error.message || 'Failed to update organization')
toast.error(getAuthErrorMessage(error) || error.message || 'Failed to save organization settings')
} finally {
setIsSaving(false)
}
@@ -1145,7 +1145,7 @@ export default function OrganizationSettings() {
toast.success('Notification settings updated')
})
.catch((err) => {
toast.error(getAuthErrorMessage(err) || 'Failed to update settings')
toast.error(getAuthErrorMessage(err) || 'Failed to save notification preferences')
setNotificationSettings(prev)
})
.finally(() => setIsSavingNotificationSettings(false))