Format 503 errors in AlertError (#21283)

* Format 503 errors in AlertError

* Small fix
This commit is contained in:
Joshen Lim authored and GitHub committed 2024-02-15 17:00:14 +08:00
1 parent dd444f54b8
commit 39f1fdae2f
2 files changed
+9 -13

No files matched your search

@@ -135,11 +135,9 @@ const SidePanelEditor = ({
}
} else {
saveRowError = new Error('No primary key')
ui.setNotification({
category: 'error',
message:
"We can't make changes to this table because there is no primary key. Please create a primary key and try again.",
})
toast.error(
"We can't make changes to this table because there is no primary key. Please create a primary key and try again."
)
}
}
}
@@ -176,13 +174,7 @@ const SidePanelEditor = ({
if (payload !== undefined && configuration !== undefined) {
try {
await saveRow(payload, isNewRecord, configuration, (error) => {
if (error) {
toast.error(
error?.message ?? 'Something went wrong while trying to save the column value'
)
}
})
await saveRow(payload, isNewRecord, configuration, () => {})
} finally {
resolve()
}
+5 -1
View File
@@ -25,13 +25,17 @@ const AlertError = ({ ref, subject, error, className }: AlertErrorProps) => {
if (subjectString) href += `&subject=${subjectString}`
if (error) href += `&message=Error:%20${error.message}`
const formattedErrorMessage = error?.message.includes('503')
? '503 Service Temporarily Unavailable'
: error?.message
return (
<Alert_Shadcn_ className={className} variant="warning" title={subject}>
<IconAlertCircle className="h-4 w-4" strokeWidth={2} />
<AlertTitle_Shadcn_>{subject}</AlertTitle_Shadcn_>
<AlertDescription_Shadcn_ className="flex flex-col gap-3">
<div>
{error?.message && <p>Error: {error?.message}</p>}
{error?.message && <p>Error: {formattedErrorMessage}</p>}
<p>
Try refreshing your browser, but if the issue persists, please reach out to us via
support.