mirror of
https://github.com/supabase/supabase.git
synced 2026-05-06 17:00:27 -04:00
aba0095bd7
* feat(content api): add error endpoint
Add an endpoint to return the details of a Supabase error, given the
error code and service.
Schema additions:
```graphql
type RootQueryType {
"...previous root queries"
"""Get the details of an error code returned from a Supabase service"""
error(code: String!, service: Service!): Error
}
"""An error returned by a Supabase service"""
type Error {
"""
The unique code identifying the error. The code is stable, and can be used for string matching during error handling.
"""
code: String!
"""The Supabase service that returns this error."""
service: Service!
"""The HTTP status code returned with this error."""
httpStatusCode: Int
"""
A human-readable message describing the error. The message is not stable, and should not be used for string matching during error handling. Use the code instead.
"""
message: String
}
enum Service {
AUTH
REALTIME
STORAGE
}
```
* test(content api): add tests for top-level query `error`
25 lines
674 B
TypeScript
25 lines
674 B
TypeScript
import { afterAll, beforeAll, vi } from 'vitest'
|
|
|
|
let oldEnv: NodeJS.ProcessEnv
|
|
|
|
beforeAll(() => {
|
|
// Use local Supabase to run e2e tests
|
|
oldEnv = { ...process.env }
|
|
process.env = {
|
|
...process.env,
|
|
NEXT_PUBLIC_SUPABASE_URL: 'http://localhost:54321',
|
|
NEXT_PUBLIC_SUPABASE_ANON_KEY:
|
|
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24iLCJleHAiOjE5ODM4MTI5OTZ9.CRXP1A7WOeoJeXxjNni43kdQwgnWNReilDMblYTn_I0',
|
|
}
|
|
|
|
// Prevent errors about importing server-only modules from Client Components
|
|
vi.mock('server-only', () => {
|
|
return {}
|
|
})
|
|
})
|
|
|
|
afterAll(() => {
|
|
process.env = oldEnv
|
|
vi.doUnmock('server-only')
|
|
})
|