Mercurial > emacs
changeset 97213:f7035abd999b
* net/dbus.el (dbus-check-event, dbus-handle-event): Handle D-Bus
error messages.
(dbus-set-property): Call `dbus-introspect-get-property' instead
of `dbus-get-property'.
author | Michael Albinus <michael.albinus@gmx.de> |
---|---|
date | Fri, 01 Aug 2008 18:41:05 +0000 |
parents | 557e6260f3d6 |
children | 004f6dc1c1a0 |
files | lisp/net/dbus.el |
diffstat | 1 files changed, 13 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/net/dbus.el Fri Aug 01 18:35:49 2008 +0000 +++ b/lisp/net/dbus.el Fri Aug 01 18:41:05 2008 +0000 @@ -266,15 +266,19 @@ (natnump (nth 3 event)) ;; Service. (or (= dbus-message-type-method-return (nth 2 event)) + (= dbus-message-type-error (nth 2 event)) (stringp (nth 4 event))) ;; Object path. (or (= dbus-message-type-method-return (nth 2 event)) + (= dbus-message-type-error (nth 2 event)) (stringp (nth 5 event))) ;; Interface. (or (= dbus-message-type-method-return (nth 2 event)) + (= dbus-message-type-error (nth 2 event)) (stringp (nth 6 event))) ;; Member. (or (= dbus-message-type-method-return (nth 2 event)) + (= dbus-message-type-error (nth 2 event)) (stringp (nth 7 event))) ;; Handler. (functionp (nth 8 event))) @@ -287,11 +291,14 @@ part of the event, is called with arguments ARGS. If the HANDLER returns an `dbus-error', it is propagated as return message." (interactive "e") - ;; By default, we don't want to raise an error, because this - ;; function is called in the event handling loop. (condition-case err (let (result) + ;; We ignore not well-formed events. (dbus-check-event event) + ;; Error messages must be propagated. + (when (= dbus-message-type-error (nth 2 event)) + (signal 'dbus-error (nthcdr 9 event))) + ;; Apply the handler. (setq result (apply (nth 8 event) (nthcdr 9 event))) ;; Return a message when it is a message call. (when (= dbus-message-type-method-call (nth 2 event)) @@ -305,8 +312,9 @@ (dbus-ignore-errors (dbus-method-error-internal (nth 1 event) (nth 3 event) (nth 4 event) (cadr err)))) - ;; Propagate D-Bus error in the debug case. - (when dbus-debug (signal (car err) (cdr err)))))) + ;; Propagate D-Bus error messages. + (when (or dbus-debug (= dbus-message-type-error (nth 2 event))) + (signal (car err) (cdr err)))))) (defun dbus-event-bus-name (event) "Return the bus name the event is coming from. @@ -724,7 +732,7 @@ (string-equal "readwrite" (dbus-introspect-get-attribute - (dbus-get-property bus service path interface property) + (dbus-introspect-get-property bus service path interface property) "access"))) ;; "Set" requires a variant. (dbus-call-method