Files
supabase/apps/studio/components/interfaces/ErrorHandling/error-mappings.tsx
2026-04-01 10:22:37 +02:00

23 lines
702 B
TypeScript

import { ComponentType } from 'react'
import { ConnectionTimeoutTroubleshooting } from './errorMappings/ConnectionTimeout'
import { ConnectionTimeoutError } from '@/types/api-errors'
import type { ClassifiedError, KnownErrorType } from '@/types/api-errors'
import type { ResponseError } from '@/types/base'
export interface ErrorMapping {
id: KnownErrorType
Troubleshooting: ComponentType
}
type ErrorConstructor = new (
...args: ConstructorParameters<typeof ResponseError>
) => ClassifiedError
export const ERROR_MAPPINGS = new Map<ErrorConstructor, ErrorMapping>([
[
ConnectionTimeoutError,
{ id: 'connection-timeout', Troubleshooting: ConnectionTimeoutTroubleshooting },
],
])