wip: directory/file move name conflict check
This commit is contained in:
@@ -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:
|
||||
|
Reference in New Issue
Block a user