- Home /
What kind of error handling does the WWW class have?
I'm working on a game that uses the WWW class to push and pull data from our web server.
Right now the bulk of our web integration is using a WWW object with some WWWForm data passed in, and yielding to the www object. The only real error handling on our part is checking www.error.
My question is do we have to do anything else on top of that? Is there any built-in timeout errors that can happen if our server is hammered/slow? Are HTTP errors (403/404) handled properly? DNS errors?
Answer by Jaap Kreijkamp · Dec 12, 2009 at 01:52 AM
While testing it, to my surprise in Unity Pro 2.6.1 a 404 Page not found is not seen as an error and gives error == null, and the resulting data the error page. At least domain not found is correctly handled by setting error string to message that it couldn't resolve the host.
Handling of timeout I didn't test but you could easily use an extra coroutine to handle the timeout situation yourself (using WWW is designed to be used in a coroutine where you yield until the data/error is available so your application should never block on it).
This is really amazing. Like actually terrible API design.
Your answer
Follow this Question
Related Questions
www.texture different in editor and on webplayer 1 Answer
opening a webpage? 1 Answer
using Application.OpenURL for opening new tab? 2 Answers
yield on WWW? or AssetBundleRequest? or both? 2 Answers
"Absolute URI is too short" woe 1 Answer