errnoToIOException

Converts platform.posix.errno to a string (e.g. ENOENT "ENOENT") as a prefix for the human-readable error message retrieved via strerror and returns it as an IOException. When platform.posix.errno is ENOENT, then this function will return FileNotFoundException. When platform.posix.errno is EINTR, then this function will return InterruptedIOException.

Return

The formatted error as an IOException

Parameters

errno

fun errnoToIOException(errno: Int, file: File?, other: File? = null): IOException(source)

Converts platform.posix.errno to a string (e.g. ENOENT "ENOENT") as a prefix for the human-readable error message retrieved via strerror and returns it as an IOException. When platform.posix.errno is ENOENT, then this function will return FileNotFoundException. When platform.posix.errno is EINTR, then this function will return InterruptedIOException.

If and only if the file parameter is non-null, an appropriate FileSystemException will be returned for the given platform.posix.errno.

Return

The formatted error as an IOException

Parameters

errno

The error

file

The File (if any) to associate this error with a FileSystemException

other

If multiple files were involved, such as a copy operation.