// ADR-0013 — Typed errors with stable codes. NEVER include the raw path, SQL text, or system error
// strings in `.message` — these surface to the BFF error envelope and must be safe to log/expose.
export class UiStoreError extends Error {
    code;
    status;
    constructor(code, message, status) {
        super(message);
        this.name = "UiStoreError";
        this.code = code;
        this.status = status;
    }
}
export function invalidPath(message) {
    return new UiStoreError("invalid_path", message, 400);
}
export function pathNotDirectory() {
    return new UiStoreError("path_not_directory", "The path is not a directory.", 400);
}
export function pathNotFound() {
    return new UiStoreError("path_not_found", "The path does not exist.", 400);
}
export function notFound(entity) {
    return new UiStoreError("not_found", `${entity} not found.`, 404);
}
export function invalidRequest(message) {
    return new UiStoreError("invalid_request", message, 400);
}
export function projectExists() {
    return new UiStoreError("project_exists", "Project already registered.", 409);
}
