export class WorkspaceBackendError extends Error {
    constructor(code, message) {
        super(message || code);
        this.name = "WorkspaceBackendError";
        this.code = code;
    }
}
export function isWorkspaceBackendError(error) {
    return typeof error === "object" && error !== null && error.name === "WorkspaceBackendError";
}
export function asWorkspaceBackendError(error) {
    if (isWorkspaceBackendError(error))
        return error;
    if (error instanceof Error)
        return new WorkspaceBackendError("UNKNOWN", error.message);
    return new WorkspaceBackendError("UNKNOWN", String(error));
}
//# sourceMappingURL=errors.js.map