@mastra/core
Version:
136 lines (135 loc) • 4.78 kB
JavaScript
//#region src/workspace/errors.ts
var WorkspaceError = class extends Error {
code;
workspaceId;
constructor(message, code, workspaceId) {
super(message);
this.code = code;
this.workspaceId = workspaceId;
this.name = "WorkspaceError";
}
};
var WorkspaceNotAvailableError = class extends WorkspaceError {
constructor() {
super("Workspace not available. Ensure the agent has a workspace configured.", "NO_WORKSPACE");
this.name = "WorkspaceNotAvailableError";
}
};
var FilesystemNotAvailableError = class extends WorkspaceError {
constructor() {
super("Workspace does not have a filesystem configured", "NO_FILESYSTEM");
this.name = "FilesystemNotAvailableError";
}
};
var SandboxNotAvailableError = class extends WorkspaceError {
constructor(message) {
super(message ?? "Workspace does not have a sandbox configured", "NO_SANDBOX");
this.name = "SandboxNotAvailableError";
}
};
var SandboxFeatureNotSupportedError = class extends WorkspaceError {
constructor(feature) {
super(`Sandbox does not support ${feature}`, "FEATURE_NOT_SUPPORTED");
this.name = "SandboxFeatureNotSupportedError";
}
};
var SearchNotAvailableError = class extends WorkspaceError {
constructor() {
super("Workspace does not have search configured (enable bm25 or provide vectorStore + embedder)", "NO_SEARCH");
this.name = "SearchNotAvailableError";
}
};
var WorkspaceNotReadyError = class extends WorkspaceError {
constructor(workspaceId, status) {
super(`Workspace is not ready (status: ${status})`, "NOT_READY", workspaceId);
this.name = "WorkspaceNotReadyError";
}
};
var WorkspaceReadOnlyError = class extends WorkspaceError {
constructor(operation) {
super(`Workspace is in read-only mode. Cannot perform: ${operation}`, "READ_ONLY");
this.name = "WorkspaceReadOnlyError";
}
};
var FilesystemError = class extends Error {
code;
path;
constructor(message, code, path) {
super(message);
this.code = code;
this.path = path;
this.name = "FilesystemError";
}
};
var FileNotFoundError = class extends FilesystemError {
constructor(path) {
super(`File not found: ${path}`, "ENOENT", path);
this.name = "FileNotFoundError";
}
};
var DirectoryNotFoundError = class extends FilesystemError {
constructor(path) {
super(`Directory not found: ${path}`, "ENOENT", path);
this.name = "DirectoryNotFoundError";
}
};
var FileExistsError = class extends FilesystemError {
constructor(path) {
super(`File already exists: ${path}`, "EEXIST", path);
this.name = "FileExistsError";
}
};
var IsDirectoryError = class extends FilesystemError {
constructor(path) {
super(`Path is a directory: ${path}`, "EISDIR", path);
this.name = "IsDirectoryError";
}
};
var NotDirectoryError = class extends FilesystemError {
constructor(path) {
super(`Path is not a directory: ${path}`, "ENOTDIR", path);
this.name = "NotDirectoryError";
}
};
var DirectoryNotEmptyError = class extends FilesystemError {
constructor(path) {
super(`Directory not empty: ${path}`, "ENOTEMPTY", path);
this.name = "DirectoryNotEmptyError";
}
};
var PermissionError = class extends FilesystemError {
operation;
constructor(path, operation) {
super(`Permission denied: ${operation} on ${path}`, "EACCES", path);
this.operation = operation;
this.name = "PermissionError";
}
};
var FileReadRequiredError = class extends FilesystemError {
constructor(path, reason) {
super(reason, "EREAD_REQUIRED", path);
this.name = "FileReadRequiredError";
}
};
var StaleFileError = class extends FilesystemError {
expectedMtime;
actualMtime;
constructor(path, expectedMtime, actualMtime) {
super(`File was modified externally: ${path} (expected mtime ${expectedMtime.toISOString()}, actual ${actualMtime.toISOString()})`, "ESTALE", path);
this.expectedMtime = expectedMtime;
this.actualMtime = actualMtime;
this.name = "StaleFileError";
}
};
/**
* Error thrown when a filesystem operation is attempted before initialization.
*/
var FilesystemNotReadyError = class extends FilesystemError {
constructor(id) {
super(`Filesystem "${id}" is not ready. Call init() first or use ensureReady().`, "ENOTREADY", id);
this.name = "FilesystemNotReadyError";
}
};
//#endregion
export { WorkspaceNotAvailableError as _, FileReadRequiredError as a, FilesystemNotReadyError as c, PermissionError as d, SandboxFeatureNotSupportedError as f, WorkspaceError as g, StaleFileError as h, FileNotFoundError as i, IsDirectoryError as l, SearchNotAvailableError as m, DirectoryNotFoundError as n, FilesystemError as o, SandboxNotAvailableError as p, FileExistsError as r, FilesystemNotAvailableError as s, DirectoryNotEmptyError as t, NotDirectoryError as u, WorkspaceNotReadyError as v, WorkspaceReadOnlyError as y };
//# sourceMappingURL=errors-B0YGz4tO.js.map