Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Ensure that all GET errors not in RQs are handled

Joshen Lim048472777c25
diff --git a/studio/components/interfaces/BillingV2/Invoices.tsx b/studio/components/interfaces/BillingV2/Invoices.tsx
index cbe2423ef41..7e76d49d5e5 100644
--- a/studio/components/interfaces/BillingV2/Invoices.tsx
+++ b/studio/components/interfaces/BillingV2/Invoices.tsx
@@ -60,7 +60,10 @@ const Invoices: FC<Props> = ({ projectRef }) => {
)
if (invoices.error) {
- ui.setNotification({ category: 'error', message: invoices.error.message })
+ ui.setNotification({
+ category: 'error',
+ message: `Failed to fetch invoices: ${invoices.error.message}`,
+ })
} else {
setInvoices(invoices)
}
@@ -75,7 +78,7 @@ const Invoices: FC<Props> = ({ projectRef }) => {
} else {
ui.setNotification({
category: 'info',
- message: 'Unable to fetch the selected invoice',
+ message: `Failed to fetch the selected invoice: ${invoice.error.message}`,
})
}
}
diff --git a/studio/components/interfaces/Docs/GeneratingTypes.tsx b/studio/components/interfaces/Docs/GeneratingTypes.tsx
index f3a222d3298..0ce44019d84 100644
--- a/studio/components/interfaces/Docs/GeneratingTypes.tsx
+++ b/studio/components/interfaces/Docs/GeneratingTypes.tsx
@@ -1,12 +1,11 @@
-import { FC, useState } from 'react'
-import Link from 'next/link'
-import React from 'react'
-import { Button, IconDownload, IconExternalLink } from 'ui'
-import { API_ADMIN_URL } from 'lib/constants'
-import { get } from 'lib/common/fetch'
-import { useStore } from 'hooks'
import { useParams } from 'common/hooks'
import CodeSnippet from 'components/to-be-cleaned/Docs/CodeSnippet'
+import { useStore } from 'hooks'
+import { get } from 'lib/common/fetch'
+import { API_ADMIN_URL } from 'lib/constants'
+import Link from 'next/link'
+import { useState } from 'react'
+import { Button, IconDownload, IconExternalLink } from 'ui'
interface Props {
selectedLang: string
diff --git a/studio/components/interfaces/Organization/InvoicesSettings/InvoicesSettings.tsx b/studio/components/interfaces/Organization/InvoicesSettings/InvoicesSettings.tsx
index 6b966e511cb..318871d4b62 100644
--- a/studio/components/interfaces/Organization/InvoicesSettings/InvoicesSettings.tsx
+++ b/studio/components/interfaces/Organization/InvoicesSettings/InvoicesSettings.tsx
@@ -69,7 +69,11 @@ const InvoicesSettings = () => {
)
if (invoices.error) {
- ui.setNotification({ category: 'error', message: invoices.error.message })
+ ui.setNotification({
+ error: invoices.error,
+ category: 'error',
+ message: `Failed to fetch invoices: ${invoices.error.message}`,
+ })
} else {
setInvoices(invoices)
}
@@ -83,8 +87,9 @@ const InvoicesSettings = () => {
window.open(invoice.invoice_pdf, '_blank')
} else {
ui.setNotification({
+ error: invoice.error,
category: 'info',
- message: 'Unable to fetch the selected invoice',
+ message: `Unable to fetch the selected invoice: ${invoice.error.message}`,
})
}
}
diff --git a/studio/pages/join/index.tsx b/studio/pages/join/index.tsx
index 5dcdfc380ef..56130ed0c13 100644
--- a/studio/pages/join/index.tsx
+++ b/studio/pages/join/index.tsx
@@ -32,7 +32,7 @@ const JoinOrganizationPage = () => {
const signOut = useSignOut()
const [isSubmitting, setIsSubmitting] = useState(false)
- const [error, setError] = useState(false)
+ const [error, setError] = useState<any>()
const [tokenValidationInfo, setTokenValidationInfo] = useState<TokenInfo>(undefined)
const [tokenInfoLoaded, setTokenInfoLoaded] = useState(false)
const { token_does_not_exist, email_match, expired_token, organization_name, invite_id } =
@@ -119,7 +119,7 @@ const JoinOrganizationPage = () => {
)
const message = error ? (
- <p>There was an error requesting details for this invitation.</p>
+ <p>There was an error requesting details for this invitation. ({error.message})</p>
) : token_does_not_exist ? (
<>
<p>The invite token is invalid.</p>
diff --git a/studio/pages/new/[slug].tsx b/studio/pages/new/[slug].tsx
index fb53b7003d5..a86b406a58f 100644
--- a/studio/pages/new/[slug].tsx
+++ b/studio/pages/new/[slug].tsx
@@ -143,6 +143,12 @@ const Wizard: NextPageWithLayout = () => {
const { data: paymentMethods, error } = await get(`${API_URL}/organizations/${slug}/payments`)
if (!error) {
setPaymentMethods(paymentMethods)
+ } else {
+ ui.setNotification({
+ error,
+ category: 'error',
+ message: `Failed to retrieve payment methods: ${error.message}`,
+ })
}
}
diff --git a/studio/pages/project/[ref]/auth/users.tsx b/studio/pages/project/[ref]/auth/users.tsx
index e68341b0acb..58ae3914a0f 100644
--- a/studio/pages/project/[ref]/auth/users.tsx
+++ b/studio/pages/project/[ref]/auth/users.tsx
@@ -11,6 +11,7 @@ import { NextPageWithLayout } from 'types'
import { PermissionAction } from '@supabase/shared-types/out/constants'
import NoPermission from 'components/ui/NoPermission'
import { useProjectContext } from 'components/layouts/ProjectLayout/ProjectContext'
+import { toast } from 'react-hot-toast'
export const PageContext = createContext(null)
@@ -67,7 +68,7 @@ const PageLayout = ({ children }: PropsWithChildren<{}>) => {
this.totalUsers = 0
this.users = []
this.usersLoading = false
- console.error(`Fetch user failed: ${response.error.message}`)
+ toast.error(`Failed to fetch users: ${response.error.message}`)
} else {
this.totalUsers = response.total
this.users = response.users
diff --git a/studio/pages/vercel/integrate.tsx b/studio/pages/vercel/integrate.tsx
index 48885764496..93150b6eec1 100644
--- a/studio/pages/vercel/integrate.tsx
+++ b/studio/pages/vercel/integrate.tsx
@@ -149,7 +149,7 @@ class VercelIntegrationStore implements IVercelIntegrationStore {
await this.getVercelProjects()
this.loading = false
} else {
- toast.error('Retrieve vercel token failed')
+ toast.error(`Failed to retrieve Vercel token: ${response.error.message}`)
this.loading = false
}
}
@@ -337,7 +337,7 @@ const ProjectLinks: FC = observer(() => {
runInAction(() => {
item.result = {
status: 'fail',
- message: 'Error: validate Vercel project envs fails',
+ message: 'Error: Failed to validate Vercel project envs',
}
})
continue
@@ -348,7 +348,7 @@ const ProjectLinks: FC = observer(() => {
runInAction(() => {
item.result = {
status: 'fail',
- message: 'Error: this Vercel project already contains Supabase envs',
+ message: 'Error: This Vercel project already contains Supabase envs',
}
})
continue
@@ -360,7 +360,7 @@ const ProjectLinks: FC = observer(() => {
runInAction(() => {
item.result = {
status: 'fail',
- message: 'Error: fetch Supabase project details fails',
+ message: 'Error: Failed to fetch Supabase project details',
}
})
continue