x


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?

more ▼

asked Dec 12 '09 at 12:34 AM

Tetrad gravatar image

Tetrad
7.3k 27 37 89

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

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).

more ▼

answered Dec 12 '09 at 01:52 AM

Jaap Kreijkamp gravatar image

Jaap Kreijkamp
6.5k 20 27 71

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x5276
x2032
x831
x548
x215

asked: Dec 12 '09 at 12:34 AM

Seen: 2285 times

Last Updated: Dec 12 '09 at 12:34 AM