Http failure (event)

From ComputerCraft Wiki
Jump to: navigation, search



Grid Modem.png  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


Grid paper.png  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



Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox