- Changed the static init method to check basic schema (root format and existence) before returning. - Added getRoot method that throws generic Error if inode 0 doesnt resolve.
48 lines
1.0 KiB
TypeScript
48 lines
1.0 KiB
TypeScript
import type { TreeNodeType } from "./treenode";
|
|
|
|
export type FileSystemError =
|
|
NotADirectoryError | AlreadyExistsError | NodeNotFoundError | IllegalMutationError | FileSystemInitializationError;
|
|
|
|
export interface FileSystemInitializationError {
|
|
type: "FileSystemInitializationError";
|
|
message: string;
|
|
timestamp: number;
|
|
}
|
|
|
|
export interface NotADirectoryError {
|
|
inode: number;
|
|
message: string;
|
|
timestamp: number;
|
|
type: "NotADirectory";
|
|
nodeType: TreeNodeType;
|
|
}
|
|
|
|
export interface AlreadyExistsError {
|
|
type: "AlreadyExists";
|
|
message: string;
|
|
timestamp: number;
|
|
parentInode: number;
|
|
name: string;
|
|
}
|
|
|
|
export interface NodeNotFoundError {
|
|
type: "NodeNotFound";
|
|
message: string;
|
|
inode: number;
|
|
timestamp: number;
|
|
}
|
|
|
|
export interface IllegalMutationError {
|
|
type: "IllegalMutation";
|
|
message: string;
|
|
timestamp: number;
|
|
}
|
|
|
|
export interface DirectoryLoopError {
|
|
type: "DirectoryLoop";
|
|
message: string;
|
|
timestamp: number;
|
|
descendantInode: number;
|
|
ancestorInode: number;
|
|
}
|