all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Oleksandr Gavenko <gavenkoa@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: Reporting error to user...
Date: Mon, 04 Mar 2013 21:23:12 +0200	[thread overview]
Message-ID: <871ubvufz3.fsf@gavenkoa.example.com> (raw)
In-Reply-To: 87k3po1de2.fsf@gmail.com

On 2013-03-03, Jambunathan K wrote:

> Oleksandr Gavenko <gavenkoa@gmail.com> writes:
>
>> I wrote blogging program in Elisp and have to report errors to users (when
>> required file not found or network authorisation failed).
>>
>> How to report error to users?
>>
>> I think that showing *Backtrace* buffer from '(error ...)' is not good way to
>> do this (I have filling that such behavior indicates bug or "not yet
>> implemented" condition in program).
>>
>> (message "...") is better but sometimes another modes hide minibufer text
>> (like semantic when showing symbol type).
>>
>> Would like to hear suggestions...
>
> Last couple of sentences down below may interest you.
>
> ,---- From (info "(elisp) Signaling Errors")
> |
> |  -- Function: user-error format-string &rest args
> |      This function behaves exactly like `error', except that it uses
> |      the error symbol `user-error' rather than `error'.  As the name
> |      suggests, this is intended to report errors on the part of the
> |      user, rather than errors in the code itself.  For example, if you
> |      try to use the command `Info-history-back' (`l') to move back
> |      beyond the start of your Info browsing history, Emacs signals a
> |      `user-error'.  Such errors do not cause entry to the debugger,
> |      even when `debug-on-error' is non-`nil'.  *Note Error
> |      Debugging::.
> |
> `----

Hm... (describe-function 'user-error) return (void-function user-error).

I use Emacs 24.2.1.


From bzr repo:

  2012-05-04  Stefan Monnier  <monnier@...>

      * data.c (PUT_ERROR): New macro.
      (syms_of_data): Use it.  Add new error type `user-error'.

Build from trunk beep and show error message in minibuffer on 'user-error'.


How to backport 'user-error' into early Emacs versions? Do I need to write
a wrapper:

  (defun my-user-error (format &rest args)
    (if (fboundp 'user-error))
         (apply 'user-error format args)
       (apply 'error format args))

in my mode and use 'my-user-error' instead if 'user-error'?

-- 
Best regards!




  reply	other threads:[~2013-03-04 19:23 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-03 18:58 Reporting error to user Oleksandr Gavenko
2013-03-03 19:39 ` Jambunathan K
2013-03-04 19:23   ` Oleksandr Gavenko [this message]
2013-03-05  4:51     ` Dmitry Gutov
2013-03-05 21:32       ` Oleksandr Gavenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=871ubvufz3.fsf@gavenkoa.example.com \
    --to=gavenkoa@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.