FileAlreadyExistsException

Checked exception thrown when an attempt is made to create a file or directory and a file of that name already exists.

actual typealias FileAlreadyExistsException = kotlin.io.FileAlreadyExistsException(source)
actual class FileAlreadyExistsException(val file: File, val other: File? = null, val reason: String? = null) : FileSystemException(source)

Checked exception thrown when an attempt is made to create a file or directory and a file of that name already exists.

Constructors

Link copied to clipboard
constructor(file: File, other: File? = null, reason: String? = null)

Properties

cause
Link copied to clipboard
open val cause: Throwable?
open val cause: Throwable?
Link copied to clipboard
actual val Throwable.errorCodeOrNull: String?

Attempts to retrieve the code from an exception thrown from JavaScript. If unable to retrieve it, null is returned.

expect val Throwable.errorCodeOrNull: String?

Attempts to retrieve the code from an exception thrown from JavaScript. If unable to retrieve it, null is returned.

actual val Throwable.errorCodeOrNull: String?

Attempts to retrieve the code from an exception thrown from JavaScript. If unable to retrieve it, null is returned.

Link copied to clipboard
expect val file: File
actual val file: File
message
Link copied to clipboard
open val message: String?
open val message: String?
Link copied to clipboard
expect val other: File?
actual val other: File? = null
Link copied to clipboard
expect val reason: String?
actual val reason: String? = null

Functions

Link copied to clipboard
fun Throwable.toIOException(): IOException
fun Throwable.toIOException(file: File?, other: File? = null): IOException

Converts the throwable to an IOException if it is not already one. When errorCodeOrNull is ENOENT, then this function will return FileNotFoundException. When the errorCodeOrNull is EINTR, then this function will return InterruptedIOException. When the errorCodeOrNull starts with ERR_FS_, then this function will return FileSystemException.

Link copied to clipboard
@JvmName(name = "wrapIO")
inline fun Throwable.wrapIOException(): IOException

Ensures that the throwable is an instance of IOException. If it is not, it will encase it in one. If the throwable is an instance of InterruptedException, this function returns an InterruptedIOException with the InterruptedException as a suppressed exception.

@JvmName(name = "wrapIO")
inline fun Throwable.wrapIOException(lazyMessage: () -> String): IOException

Ensures that the throwable is an instance of IOException. If it is not, it will encase it in one with the provided lazyMessage. If the throwable is an instance of InterruptedException, this function returns an InterruptedIOException with the InterruptedException as a suppressed exception.