Promises are definitely the way to go. They can take a little getting used 
when using them in a nested fashion but are definitely robust and extremely 
effective when designing truly asynchronous front-ends.

The spec can be found at Promises/A+ <https://promisesaplus.com/>. Some 
good examples can be found here 
<http://www.html5rocks.com/en/tutorials/es6/promises/>. An important 
consideration is browser compatibility. For that, I would suggest caniuse 
<http://caniuse.com/#feat=promises> or kangax 
<https://kangax.github.io/compat-table/es6/#test-Promise>. With some 
practiced modular design, one can get to code like so:

asyncRequestForJSON(url)
    .then(validateData)
    .then(saveToLocalStorage)
    .then(updateUI);

In the above, the intent of the code is very clear. In a sense, this makes 
asynchronous code readable in a top-to-bottom linear fashion. I hope this 
information is helpful and provides some food for thought.

On Wednesday, April 27, 2016 at 3:43:17 PM UTC-4, Renaud Tarnec wrote:
>
> Hello,
>
> Today, after calling one of my Endpoints from a web page through the 
> JavaScript API I got the following values for the response from the API:
>
> resp.code: -1
>
> resp.message:  A network error occurred, and the request could not be 
> completed.
>
> This endpoint saves an entity in the Datastore with Objectify and adds a 
> Task to a Queue (all within an Objectify transaction). Actually the code 
> was executed correctly, despite the error message (i.e. the entity was 
> saved in the Datastore and the task executed correctly).
>
> It's the first time I encounter this error, and its several months I work 
> on this application. Right after I was able to call the API the same way 
> without anymore problems.
>
> Any explanations or recommendations?
>
> Many thanks in advance
> Renaud
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/google-appengine.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/a245317a-8706-4cdc-a657-b743f51f5f0f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to