File.RenameError exception (Elixir v1.19.0-dev)

View Source

An exception that is raised when renaming a file fails.

For example, this exception is raised when trying to rename a file that isn't present:

iex> File.rename!("source.txt", "target.txt") ** (File.RenameError) could not rename from "source.txt" to "target.txt": no such file or directory

The following fields of this exception are public and can be accessed freely:

  • :source (Path.t/0) - the source path
  • :destination (Path.t/0) - the destination path
  • :reason (File.posix/0) - the reason why the file could not be renamed