Subject: bug#28792: 26.0.60; Deleting to a custom trash directory in Dired gives error

From: Noam Postavsky <[email-masked]>
Date: Thu, 12 Oct 2017 10:24:05 -0400

On Thu, Oct 12, 2017 at 9:16 AM, Eli Zaretskii <[email-masked]> wrote:
>> From: Kaushal Modi <[email-masked]>
>> Date: Thu, 12 Oct 2017 12:58:57 +0000
>> Cc: Paul Eggert <[email-masked]>, [email-masked]
>>
>> That is still a bug in Emacs, at least because the error message is not helpful. It is also in a non-standard
>> format with incorrect capitalizations in-between and doesn't even generate a backtrace by default.
>
> FWIW, I see no problem with the error message, we produce such error
> messages in quite a few other places in fileio.c.  The capitalization
> seems okay, too.
>
> As for lack of backtrace, that's because the error comes from a C
> primitive.

The lack of backtrace and odd formatting is because of a
condition-case in dired-internal-do-deletions:

(defun dired-internal-do-deletions (l arg &optional trash)
  ...
        (condition-case err
              ...
              (dired-delete-file fn dired-recursive-deletes trash)
              ...
          (error ;; catch errors from failed deletions
           (dired-log "%s\n" err)
           (setq failures (cons (car (car l)) failures)))))

Compare

  (condition-case err
      (signal 'file-error '("Non-regular file" "Is a directory" "/the/file/"))
    (error
     (message "%s\n" err)))

vs

  (condition-case err
      (signal 'file-error '("Non-regular file" "Is a directory" "/the/file/"))
    (error
     (message "%s: %s\n" (car err) (error-message-string err))))