[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Why doesn't dbus-handle-event catch all errors?
From: |
Michael Albinus |
Subject: |
Re: Why doesn't dbus-handle-event catch all errors? |
Date: |
Mon, 24 Feb 2014 09:37:00 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) |
Daniel Colascione <address@hidden> 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.