Skip to content

Io Error

1 min read

Import: import system.io;

IoError

Filesystem / path failure implementing Error.

public class IoError: Error

path

Path involved in the failure (may be empty for non-path errors).

public path: string

constructor

Creates an error with path, machine code, and message.

public constructor(path: string, code: string, message: string)

message

Human-readable explanation of the I/O failure, suitable for logs and error output.

public fun message(): string

code

Stable machine code (ENOENT, EACCES, EIO, EEXIST, …).

public fun code(): string

not_found

File or directory does not exist.

public static fun not_found(path: string): IoError

permission_denied

Permission was denied for the operation.

public static fun permission_denied(path: string): IoError

other

Generic I/O failure with a custom message.

public static fun other(path: string, message: string): IoError

exists

Path already exists when exclusive create was requested.

public static fun exists(path: string): IoError

closed

Creates an ECLOSED error for an operation on a closed resource.

public static fun closed(path: string): IoError

invalid

Creates an EINVAL error for an invalid argument or operation.

public static fun invalid(path: string, message: string): IoError

cancelled

Cooperative cancellation (CancellationToken).

public static fun cancelled(): IoError