Difference between revisions of "Http failure (event)"
From ComputerCraft Wiki
(Created event page) |
(Trim a bit, clarify description) |
||
(One intermediate revision by one other user not shown) | |||
Line 1: | Line 1: | ||
− | |||
− | |||
{{Event | {{Event | ||
|name=http_failure | |name=http_failure | ||
− | |desc=Fired when a call to [[http.request | + | |return1=The URL to the website |
− | + | |desc=Fired when a call to [[http.request]] fails, and used internally in [[http.get]] and [[http.post]]. | |
+ | }} | ||
+ | {{Example | ||
+ | |desc=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 | ||
}} | }} |
Latest revision as of 23:05, 5 May 2013
![]() | |
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 |
![]() | |
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 |