> For the complete documentation index, see [llms.txt](https://jmdash.gitbook.io/jmdash-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://jmdash.gitbook.io/jmdash-docs/design-documents/initial-design-of-error-handling-document/the-error-tree/fserrors.md).

# FSErrors

This page contains all of the errors listed in the **FSError** category, these are related to the\
[`.frnw` library](/jmdash-docs/jmbasics/syntax101/calling-functions/other-libraries/file-read-and-write.md)

```
FSError;
    -> FileNotFound;
        // Error when attempting to access a file that does not exist
        // e.g. `fs.rnw{>> "nonexistentfile.txt"};`

    -> FileAlreadyExists;
        // Error when trying to create a file that already exists without permission or the option to overwrite
        // e.g. `fs.new{"existingfile.txt"};` (if overwriting is not allowed)

    -> PermissionDenied;
        // Error when the program lacks the necessary permissions to access, create, or modify a file
        // e.g. `fs.rnw{>> "protectedfile.txt"};` (when trying to modify a read-only file)

    -> InvalidFilePath;
        // Error when the file path provided is invalid or incorrectly formatted
        // e.g. `fs.new{>> "C:/Invalid/Path?name.txt"};`

    -> DiskFull;
        // Error when there is no space left on the disk to create or write to a file
        // e.g. `fs.rnw{>> "bigfile.txt" << "Huge data block...";}`

    -> FileCorrupted;
        // Error when a file is found but is unreadable or corrupted
        // e.g. `fs.rnw{>> "corruptedfile.txt" << con.out{}};` (when attempting to read from a corrupted file)

    -> FileLocked;
        // Error when the file is currently being used by another process and cannot be accessed
        // e.g. `fs.rnw{>> "lockedfile.txt" << con.out{}};` (attempt to access a locked file)

    -> InvalidFileOperation;
        // Error when an invalid operation is attempted on a file, such as reading from a write-only file
        // e.g. `fs.rnw{>> "writeonlyfile.txt" << con.out{}};` (attempt to read from a write-only file)

    -> UnsupportedFileFormat;
        // Error when attempting to read or write a file in an unsupported format
        // e.g. `fs.rnw{>> "unsupportedfile.xyz"};`

    -> PathTooLong;
        // Error when the file path exceeds the maximum allowed length
        // e.g. `fs.new{>> "C:/.../verylongfilename.txt"};`

    -> FileAccessDenied;
        // Error when access to a file is explicitly denied, even if permissions seem correct
        // e.g. `fs.rnw{>> "restrictedfile.txt"};` (OS-level access denial)

    -> FileNotWritable;
        // Error when attempting to write to a file that is marked as read-only
        // e.g. `fs.rnw{>> "readonlyfile.txt" << con.out{"Trying to write"};}`

    -> FileNotReadable;
        // Error when attempting to read a file that is not marked as readable
        // e.g. `fs.rnw{>> "writeonlyfile.txt" << con.out{}};`

    -> FileHandleError;
        // Error related to issues with obtaining or releasing a file handle
        // e.g. `fs.rnw{>> "somefile.txt" << con.out{}};` (when the file handle cannot be acquired or released properly)

    -> DirectoryNotFound;
        // Error when a specified directory does not exist
        // e.g. `fs.new{>> "C:/nonexistentfolder/file.txt"};`

    -> DirectoryNotWritable;
        // Error when attempting to write to a directory that is not writable
        // e.g. `fs.new{>> "C:/protectedfolder/file.txt"};`

    -> DirectoryAccessDenied;
        // Error when access to a directory is denied
        // e.g. `fs.rnw{>> "C:/restrictedfolder/file.txt"};`

    -> InvalidDirectoryOperation;
        // Error when an invalid operation is attempted on a directory, such as trying to open it as a file
        // e.g. `fs.rnw{>> "C:/somefolder"};` (attempt to read a directory as a file)
```
