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

View Source

An exception that is raised when copying a file fails.

For example, this exception is raised when trying to copy to file or directory that isn't present:

iex> File.cp_r!("non_existent", "source_dir/subdir")
** (File.CopyError) could not copy recursively from "non_existent" to "source_dir/subdir". non_existent: 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 copied