all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* url-retrieve - how to access status
@ 2014-03-17  6:56 Martin
  0 siblings, 0 replies; only message in thread
From: Martin @ 2014-03-17  6:56 UTC (permalink / raw)
  To: help-gnu-emacs


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:

Doing:

(require 'url)

(defun my-callback (status)
  "docstring"
  ;; 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 "http://0.0.0.0:3000" 'my-callback)

where 0.0.0.0:3000 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 "0.0.0.0" :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,
Martin



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2014-03-17  6:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-17  6:56 url-retrieve - how to access status Martin

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.