[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

url-retrieve - how to access status

From: Martin
Subject: url-retrieve - how to access status
Date: Mon, 17 Mar 2014 07:56:49 +0100
User-agent: mu4e; emacs 24.3.1

Hi there.

This time I come with a minimal example.

The info page says:

| STATUS is a plist representing what happened during the request,
| with most recent events first, or an empty list if no events have
| occurred.  Each pair is one of:
| (:redirect REDIRECTED-TO) - the request was redirected to this URL
| (:error (ERROR-SYMBOL . DATA)) - an error occurred.  The error can be
| signaled with (signal ERROR-SYMBOL DATA).

But I'm not able to handle that, about 2 hours didn't help me to find
the solution:


(require 'url)

(defun my-callback (status)
  ;; what has to be here if I want to know why my buffer is empty.
  ;; specialy I want to handle the status for its :error - but I don't
  ;; know why.
  (prin1 status)
  (switch-to-buffer (current-buffer)))

(url-retrieve ""; 'my-callback)

where works if my ruby on rails server is started, but if
not i get on the prin1 line:

(:error (error connection-failed "failed with code 111
" :host "" :service 3000))

but how can I make a good message to the minibuffer so the user knows
the server is not reachable or something, and second, how do I have to
set up conditional parameters, not to switch to the buffer or something.

That would be easy for you, but I didn't figure it out and want to learn
from you.

Thanks for your help,

reply via email to

[Prev in Thread] Current Thread [Next in Thread]