Browse Source

Extract the error lambda into a function

Also return nil at the end of entity-list to avoid getting long
messages printed out.
elexandria
Damien Cassou 3 years ago
parent
commit
a766db07ba
No known key found for this signature in database GPG Key ID: A7123815F5DCE914
1 changed files with 6 additions and 2 deletions
  1. +6
    -2
      libelcouch.el

+ 6
- 2
libelcouch.el View File

@ -157,6 +157,10 @@ considered to have failed."
(cl-defmethod libelcouch--entity-children-url ((database libelcouch-database))
(format "%s/%s" (libelcouch-entity-url database) "_all_docs"))
(cl-defun libelcouch--request-error (&rest args &key error-thrown &allow-other-keys)
"Report an error when communication with an instance fails."
(error "Got error: %S" error-thrown))
;;; Navigating
@ -180,8 +184,8 @@ considered to have failed."
(lambda (&key data &allow-other-keys)
(let* ((children (libelcouch--entity-create-children-from-json entity data)))
(funcall function children))))
:error (cl-function (lambda (&rest args &key error-thrown &allow-other-keys)
(message "Got error: %S" error-thrown)))))
:error #'libelcouch--request-error)
nil)
(provide 'libelcouch)
;;; libelcouch.el ends here

Loading…
Cancel
Save