* Why doesn't dbus-handle-event catch all errors?
@ 2014-02-21 4:37 Daniel Colascione
2014-02-21 7:22 ` Michael Albinus
0 siblings, 1 reply; 5+ messages in thread
From: Daniel Colascione @ 2014-02-21 4:37 UTC (permalink / raw)
To: Emacs developers
dbus-handle-event uses a condition-case that catches dbus-error, but
errors in general. Why don't we send all lisp errors from handler
functions back to callers as dbus errors?
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Why doesn't dbus-handle-event catch all errors?
2014-02-21 4:37 Why doesn't dbus-handle-event catch all errors? Daniel Colascione
@ 2014-02-21 7:22 ` Michael Albinus
2014-02-21 8:13 ` Daniel Colascione
0 siblings, 1 reply; 5+ messages in thread
From: Michael Albinus @ 2014-02-21 7:22 UTC (permalink / raw)
To: Daniel Colascione; +Cc: Emacs developers
Daniel Colascione <dancol@dancol.org> writes:
> dbus-handle-event uses a condition-case that catches dbus-error, but
> errors in general. Why don't we send all lisp errors from handler
> functions back to callers as dbus errors?
Because they aren't dbus errors. If your handler has some stupid code
like `(car 42)', the resulting lisp error `(wrong-type-argument listp 42)'
shouldn't be shown as *dbus* error.
You're free to write a handler which returns any error as dbus error, if
your program logic requires this.
Best regards, Michael.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Why doesn't dbus-handle-event catch all errors?
2014-02-21 7:22 ` Michael Albinus
@ 2014-02-21 8:13 ` Daniel Colascione
2014-02-24 8:37 ` Michael Albinus
0 siblings, 1 reply; 5+ messages in thread
From: Daniel Colascione @ 2014-02-21 8:13 UTC (permalink / raw)
To: Michael Albinus; +Cc: Emacs developers
On 02/20/2014 11:22 PM, Michael Albinus wrote:
> Daniel Colascione <dancol@dancol.org> writes:
>
>> dbus-handle-event uses a condition-case that catches dbus-error, but
>> errors in general. Why don't we send all lisp errors from handler
>> functions back to callers as dbus errors?
>
> Because they aren't dbus errors. If your handler has some stupid code
> like `(car 42)', the resulting lisp error `(wrong-type-argument listp 42)'
> shouldn't be shown as *dbus* error.
Any nonlocal exit of a dbus handler message handler ought to be a dbus
error: that nonlocal exit results in a program that expects a dbus reply
not getting one at all.
> You're free to write a handler which returns any error as dbus error, if
> your program logic requires this.
The only reasonable implementation of a dbus handler is one that
transforms lisp errors to dbus errors, so why not do that automatically
in dbus.el? Silently swallowing lisp errors is the less common case, and
if a program needs to do that, it can wrap its logic in ignore-errors
inside the handler.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Why doesn't dbus-handle-event catch all errors?
2014-02-21 8:13 ` Daniel Colascione
@ 2014-02-24 8:37 ` Michael Albinus
2014-02-24 8:39 ` Daniel Colascione
0 siblings, 1 reply; 5+ messages in thread
From: Michael Albinus @ 2014-02-24 8:37 UTC (permalink / raw)
To: Daniel Colascione; +Cc: Emacs developers
Daniel Colascione <dancol@dancol.org> writes:
>> You're free to write a handler which returns any error as dbus error, if
>> your program logic requires this.
>
> The only reasonable implementation of a dbus handler is one that
> transforms lisp errors to dbus errors, so why not do that
> automatically in dbus.el? Silently swallowing lisp errors is the less
> common case, and if a program needs to do that, it can wrap its logic
> in ignore-errors inside the handler.
There is the special error type `dbus-error'. Any handler could catch
lisp errors and transform them into something which is understandable to
another process. You do not want to send "(wrong-type-argument listp
42)" or something like this to another process, which isn't aware of Lisp.
Your handler shall include something like
(defun my-dbus-method-handler (&rest args)
(condition-case err
(...)
(error (signal 'dbus-error (list "Something went wrong, please try it again")))))
Best regards, Michael.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Why doesn't dbus-handle-event catch all errors?
2014-02-24 8:37 ` Michael Albinus
@ 2014-02-24 8:39 ` Daniel Colascione
0 siblings, 0 replies; 5+ messages in thread
From: Daniel Colascione @ 2014-02-24 8:39 UTC (permalink / raw)
To: Michael Albinus; +Cc: Emacs developers
On 02/24/2014 12:37 AM, Michael Albinus wrote:
> Daniel Colascione <dancol@dancol.org> writes:
>
>>> You're free to write a handler which returns any error as dbus error, if
>>> your program logic requires this.
>>
>> The only reasonable implementation of a dbus handler is one that
>> transforms lisp errors to dbus errors, so why not do that
>> automatically in dbus.el? Silently swallowing lisp errors is the less
>> common case, and if a program needs to do that, it can wrap its logic
>> in ignore-errors inside the handler.
>
> There is the special error type `dbus-error'. Any handler could catch
> lisp errors and transform them into something which is understandable to
> another process. You do not want to send "(wrong-type-argument listp
> 42)" or something like this to another process, which isn't aware of Lisp.
Why not? It's more informative than "something went wrong".
>
> Your handler shall include something like
>
> (defun my-dbus-method-handler (&rest args)
> (condition-case err
> (...)
> (error (signal 'dbus-error (list "Something went wrong, please try it again")))))
>
Sure. My point is that the framework should provide *something*, even if
it's just the above, instead of silently dropping lisp errors and not
telling callers that anything went wrong. Handlers that want to swallow
errors can do so explicitly.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-02-24 8:39 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-21 4:37 Why doesn't dbus-handle-event catch all errors? Daniel Colascione
2014-02-21 7:22 ` Michael Albinus
2014-02-21 8:13 ` Daniel Colascione
2014-02-24 8:37 ` Michael Albinus
2014-02-24 8:39 ` Daniel Colascione
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.