refactor: move convex into packages

This commit is contained in:
2025-09-16 23:17:01 +00:00
parent 223a594479
commit 68ca8cbccd
22 changed files with 43 additions and 14 deletions

View File

@@ -0,0 +1,22 @@
import { ConvexError } from "convex/values"
export enum Code {
DirectoryExists = "DirectoryExists",
DirectoryNotFound = "DirectoryNotFound",
FileExists = "FileExists",
Internal = "Internal",
Unauthenticated = "Unauthenticated",
}
export type ApplicationError = ConvexError<{ code: Code; message: string }>
export function isApplicationError(error: unknown): error is ApplicationError {
return error instanceof ConvexError && "code" in error.data
}
export function create(code: Code, message?: string) {
return new ConvexError({
code,
message,
})
}