Do networks even signal to the device that it is offline due to insufficient funds?
That aside, I'm not sure that we should tell every app that the user is out of funds and rely on them to communicate this to the user. It seems better for the system to signal this. / Jonas On Jan 30, 2014 4:20 AM, "Adrian Custer" <[email protected]> wrote: > Hey all, > > How does a web app know when an XHR is rejected because of lack of funds? > > > In the catch block of: > > try { > var xhr = new XMLHttpRequest( props_for_request ); > ... > xhr.send( JSON.stringify( {'items': items_to_send } ) ); > ... > } catch (err) { > ... > } > > I am currently getting the error : > > [Exception... "Failure" nsresult:"0x80004005 (NS_ERROR_FAILURE)" location: > "JS > frame::app://6e9ae3f8-4f4e-8243-8087-4b1a2015c199/app.js::send_items::line381" > data:no] > > I currently suspect that this is due to a zero balance which blocks the > use of the cell phone data channel. > > > > Is this error the most detailed information available to the web app for > such a case? > > Is the "data:no" at the end a canonical indicator that the use of the data > channel has been refused? > > Is there any way to know that the refusal was due to lack of funds (versus > badly configured data channel or other reasons)? > > > > I'd like to help the users by transforming that error into a more helpful > prompt but to do so I wanted to get a sense of the scope of these kinds of > errors sent to a web app. > > thanks, > ~adrian > _______________________________________________ > dev-b2g mailing list > [email protected] > https://lists.mozilla.org/listinfo/dev-b2g > _______________________________________________ dev-b2g mailing list [email protected] https://lists.mozilla.org/listinfo/dev-b2g
