Skip to content
Advertisement

Tag: es6-promise

Javascript Array of Functions get auto executed

I need to make a sequence of Promises that are executed in a queue. They are dynamic so I need to put them in an array (I have found an article that explains how to). The problem is that my array of functions autoexecuted it self (version with a normal funciton): I don’t know why, an array of functions is

Unexpected unhandledRejection event for promise which rejection does get handled

Updated, I’ve now tried explaining the behavior I’m seeing, but it’d still be great to have an answer from a credible source about the unhandledRejection behavor. I’ve also started a discussion thread on Reddit. Why do I get an unhandledRejection event (for “error f1”) in the following code? That’s unexpected, because I handle both rejections in the finally section of

Filtering an array returned from Promise

I am porting the following code: Current version should use SerialPort.list(), which returns a promise. So far, I tried something along these lines, without success: Obviously I am not quite getting what I should do. So the question is: how should I represent the same intent of former FindDevices function, using async/await or Promises? And what would be a good

Javascript: how to create an infinite-loop of promises?

I want to write in Javascript the following pseudo-code: I’ll explain it in words: asyncOperation uses a Promise, for example an AJAX call. I want that if the promise is rejected, then asyncOperation will be invoked again. Do you know how it can be done in Javascript? Answer If you’re going to use a loop, then you will have to

Two promises with a single then for either one of them

I have a function that takes an input, according to that input it will either call one of two functions (both return a promise) I want then to call the same .then() after whatever of them happened. I found Promise.any() but that doesn’t quite do what I want. For curious minds : I am working on a react-native app and

UnhandledPromiseRejectionWarning : error handling in an async callback function

I have an async callback function, which throws an error if some condition isn’t met. but I get the below error (node:77284) UnhandledPromiseRejectionWarning: Error: Not Found UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). My Code : What

Advertisement