[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Reporting error to user...
From: |
Oleksandr Gavenko |
Subject: |
Re: Reporting error to user... |
Date: |
Mon, 04 Mar 2013 21:23:12 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux) |
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!