wip: directory/file move name conflict check

This commit is contained in:
2025-09-21 22:24:24 +00:00
parent 29eab87c71
commit 8062fdb7f3
2 changed files with 40 additions and 2 deletions

View File

@@ -1,6 +1,7 @@
import { ConvexError } from "convex/values"
export enum Code {
Conflict = "Conflict",
DirectoryExists = "DirectoryExists",
DirectoryNotFound = "DirectoryNotFound",
FileExists = "FileExists",
@@ -8,13 +9,13 @@ export enum Code {
Unauthenticated = "Unauthenticated",
}
export type ApplicationError = ConvexError<{ code: Code; message: string }>
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) {
export function create(code: Code, message?: string): ApplicationError {
return new ConvexError({
code,
message: