network.request POST occasionally returning event.status == -1

We have an app in production. In our error logging system we noticed that occasionally, one of our network.request POST call will return with an event.status==-1. It feels like this is something that Corona itself may be sending back (rather than the server). So, I am trying to figure out if this is something I should worry about. Or, is this just a standard status if Corona can’t connect to the server? 

Many thanks,

Andrew 

Unless I remember wrong, -1 is a status code that you can get due to network issues, such failing to connect to a remote host or not receiving a response back from the remote host.

I’d double check your server side code and settings.

Are you testing the event.isError value?

The event.status should have the HTTP response code from the server. These are codes like 200 - Success, 404 - Resource not found, 500 - Internal Server Error. The presence of one of these codes means that your app successfully connected to a web server and executed an HTTP request.

However, there are other conditions where your app cannot execute an HTTP request. It could be you’re connecting to a server that doesn’t have a web server running on the port you’re connecting to (80 for HTTP, 443 for HTTPS, or user-specified), or there is a web server, but it’s hung up and not responding, or the server could be down, or there is a networking problem preventing you from reaching the server. All of these conditions, the .isError parameter should be true, and the .status value is irrelevant. I would treat a -1 as the value when .isError is true since we couldn’t complete a valid HTTP request.

Rob

Thank you so much for the clarification Rob! By testing for .isError, we are now handling things correctly. thx.

Unless I remember wrong, -1 is a status code that you can get due to network issues, such failing to connect to a remote host or not receiving a response back from the remote host.

I’d double check your server side code and settings.

Are you testing the event.isError value?

The event.status should have the HTTP response code from the server. These are codes like 200 - Success, 404 - Resource not found, 500 - Internal Server Error. The presence of one of these codes means that your app successfully connected to a web server and executed an HTTP request.

However, there are other conditions where your app cannot execute an HTTP request. It could be you’re connecting to a server that doesn’t have a web server running on the port you’re connecting to (80 for HTTP, 443 for HTTPS, or user-specified), or there is a web server, but it’s hung up and not responding, or the server could be down, or there is a networking problem preventing you from reaching the server. All of these conditions, the .isError parameter should be true, and the .status value is irrelevant. I would treat a -1 as the value when .isError is true since we couldn’t complete a valid HTTP request.

Rob

Thank you so much for the clarification Rob! By testing for .isError, we are now handling things correctly. thx.