Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | 2x 9x 8x 10x 5x 5x 4x 6x 5x 2x | import { Data } from "effect";
// Base error class for all application errors
export class AppError extends Data.TaggedError("AppError")<{
message: string;
cause?: unknown;
timestamp?: number;
}> {
constructor(params: { message: string; cause?: unknown }) {
super({
...params,
timestamp: Date.now(),
});
}
}
// Network/HTTP errors
export class NetworkError extends Data.TaggedError("NetworkError")<{
message: string;
statusCode?: number;
url?: string;
}> {}
// Validation errors
export class ValidationError extends Data.TaggedError("ValidationError")<{
message: string;
field?: string;
errors?: Record<string, string>;
}> {}
// Database errors
export class DatabaseError extends Data.TaggedError("DatabaseError")<{
message: string;
query?: string;
code?: string;
}> {}
// Authentication errors
export class AuthError extends Data.TaggedError("AuthError")<{
message: string;
code?: string;
}> {}
// Not Found errors
export class NotFoundError extends Data.TaggedError("NotFoundError")<{
message: string;
resource?: string;
id?: string;
}> {}
// Timeout errors
export class TimeoutError extends Data.TaggedError("TimeoutError")<{
message: string;
duration?: number;
}> {}
export class SignUpError extends Data.TaggedError("SignUpError")<{
message: string;
cause?: unknown;
}> {}
|