From eac3b534326aa16f733fbd96957732f7e6f35fb3 Mon Sep 17 00:00:00 2001 From: Yves Orton Date: Wed, 16 Apr 2025 16:04:54 +0200 Subject: [PATCH] File.LinkError - swap order of new and existing in error message The api for creating links is ln(existing, new) but the old error text said "from existing to new", where I believe it should say "from new to existing". Likely this error came from the example using "source.txt" and "target.txt" and it being natural to say "to target", so this patch also changes the example to use "existing.txt" and "link.txt" as the file names so it reads more naturally. --- lib/elixir/lib/exception.ex | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/elixir/lib/exception.ex b/lib/elixir/lib/exception.ex index 8aeb2f52c77..4097a3ce0cc 100644 --- a/lib/elixir/lib/exception.ex +++ b/lib/elixir/lib/exception.ex @@ -2492,8 +2492,8 @@ defmodule File.LinkError do For example, this exception is raised when trying to link to file that isn't present: - iex> File.ln!("source.txt", "target.txt") - ** (File.LinkError) could not create hard link from "source.txt" to "target.txt": no such file or directory + iex> File.ln!("existing.txt", "link.txt") + ** (File.LinkError) could not create hard link from "link.txt" to "existing.txt": no such file or directory The following fields of this exception are public and can be accessed freely: @@ -2509,8 +2509,8 @@ defmodule File.LinkError do def message(exception) do formatted = IO.iodata_to_binary(:file.format_error(exception.reason)) - "could not #{exception.action} from #{inspect(exception.existing)} to " <> - "#{inspect(exception.new)}: #{formatted}" + "could not #{exception.action} from #{inspect(exception.new)} to " <> + "#{inspect(exception.existing)}: #{formatted}" end end