Typed error classes for database, validation, auth, not found, and network failures.
// Source: https://github.com/imbhargav5/nextbase-nextjs-supabase-starter | License: MIT | Copyright 2023 Bhargav Ponnapalli
// Provided via justclaw.it.com; keep this notice with the code.
import { Data } from 'effect';
/**
* Base error for database operations with Supabase/Postgres
*/
export class DatabaseError extends Data.TaggedError('DatabaseError')<{
message: string;
code?: string;
details?: string;
hint?: string;
}> {}
/**
* Error for data validation failures
*/
export class ValidationError extends Data.TaggedError('ValidationError')<{
message: string;
field?: string;
}> {}
/**
* Error for authentication and authorization failures
*/
export class AuthenticationError extends Data.TaggedError(
'AuthenticationError'
)<{
message: string;
}> {}
/**
* Error for
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key