Add ein:query-default-error-callback

This commit is contained in:
Takafumi Arakaki 2012-06-08 14:01:33 +02:00
parent 01143e1f35
commit 7c04c3927f

View file

@ -57,6 +57,15 @@
;;; Functions ;;; Functions
(defun* ein:query-default-error-callback (url &key symbol-status
&allow-other-keys)
(ein:log 'error
"Error (%s) while connecting to %s. Please retry."
symbol-status url))
(defun ein:query-get-default-error-callback (url)
(cons #'ein:query-default-error-callback url))
(defun* ein:query-ajax (url &rest settings (defun* ein:query-ajax (url &rest settings
&key &key
(cache t) (cache t)
@ -121,6 +130,9 @@ is killed immediately after the execution of this function.
(ein:log 'debug "EIN:QUERY-AJAX") (ein:log 'debug "EIN:QUERY-AJAX")
(unless cache (unless cache
(setq url (ein:url-no-cache url))) (setq url (ein:url-no-cache url)))
(unless error
(setq error (ein:query-get-default-error-callback url))
(plist-put settings :error error))
(let* ((url-request-extra-headers headers) (let* ((url-request-extra-headers headers)
(url-request-method type) (url-request-method type)
(url-request-data data) (url-request-data data)