From: Martin <kleinerdrache@gmx.at>
To: help-gnu-emacs@gnu.org
Subject: url-retrieve - how to access status
Date: Mon, 17 Mar 2014 07:56:49 +0100 [thread overview]
Message-ID: <87bnx5l3da.fsf@gmx.at> (raw)
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
reply other threads:[~2014-03-17 6:56 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87bnx5l3da.fsf@gmx.at \
--to=kleinerdrache@gmx.at \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.