Difference between revisions of "Http failure (event)"
From ComputerCraft Wiki
(Added code example.) |
(Trim a bit, clarify description) |
||
Line 1: | Line 1: | ||
− | |||
− | |||
{{Event | {{Event | ||
|name=http_failure | |name=http_failure | ||
− | |return1=The URL to the website | + | |return1=The URL to the website |
− | |desc=Fired when a call to [[http.request | + | |desc=Fired when a call to [[http.request]] fails, and used internally in [[http.get]] and [[http.post]]. |
}} | }} | ||
{{Example | {{Example |
Latest revision as of 23:05, 5 May 2013
Event http_failure | |
Fired when a call to http.request fails, and used internally in http.get and http.post. | |
Returned Object 1 | The URL to the website |
Example | |
Prints a message and quits when the requested URL could not be contacted. | |
Code |
http.request( "http://www.example-failure.com" ) while true do event, url = os.pullEvent() if event == "http_failure" then print( "Cannot contact the server: "..url ) break end end |