Questions tagged [bluebird]

Bluebird is a fully featured promise library for client and server JavaScript with focus on innovative features and performance.

Bluebird is a fully featured promise library for client and server JavaScript code with focus on innovative features and performance.

Bluebird is known for its fast performance, context binding, and long stack traces. It offers very fast coroutine support that emulates C#'s async/await statement.

Bluebird's promise system also cures JavaScript's callback problem.

It is a fully A+ spec compliant implementation.

Bluebird supports both Node.js and browsers (with Browserify and directly).

1871 questions
0
votes
0 answers

Promise multiples values

I'm new to promise and to me it feels like a promise if a function that can only have 1 argument. And in many case it makes me very frustrated. How am I supposed to handle cases such as the following with promises (simplified example) /** * @api…
IggY
  • 3,005
  • 4
  • 29
  • 54
0
votes
1 answer

What is a sensible way to structure my control flow (promises and looping)?

I'm not sure of how to adequately achieve my desired control flow using promises/bluebird. Essentially I have a database with X 'tasks' stored and each needs to be loaded and executed sequentially. I don't want to run more than one task concurrently…
kurt343
  • 145
  • 1
  • 13
0
votes
0 answers

Using promise all with and continue process approaches

Im using the following code which is working, as you can see I need to run process 1 and 2 in parallel and then run process 3 & 4 so my question is if I doing that right ? or if there an more elegant way to do it ?(I use bluebird and start to work…
user6124024
0
votes
1 answer

How to write a correct callback to a get function that includes Promises?

I am trying to write a health check for my code (This check involved communication with Cassandra DB and Kafka). This is the code I wrote: // health-check app.get('/stats/health', function(req, res, next) { Promise.all([cassandraPromise,…
CrazySynthax
  • 13,662
  • 34
  • 99
  • 183
0
votes
1 answer

Delaying promises: .delay() doesn't seem to work

This is an extended question from Throttling requests to 3rd part Apis with Node . You can see my full code in that post if you want to see the sub functions and a little backstory of what im trying to do. What i need to do is delay api request to…
CoffeePeddlerIntern
  • 659
  • 3
  • 13
  • 29
0
votes
1 answer

bluebirdjs coroutine error handling (browser)

How am I supposed handle errors in bluebird coroutines? I've used co in node for a while which has a great catch function. co(function*() { return new Promise(function(resolve, reject) { // whatever stuff }); }).catch(function(err)…
LongHike
  • 4,016
  • 4
  • 37
  • 76
0
votes
2 answers

How do I mix all this logic with javascript Promises?

I'm using bluebird in Node, and I'm still pretty new to using Promises, especially when things start getting beyond the basics. Here's a function I need to construct using Promises, and I'm struggling to figure out the best way to set it up. At a…
Tim Hardy
  • 1,654
  • 1
  • 17
  • 36
0
votes
0 answers

Promise Error not getting propagated

My code is like this, function promisefn1() { return someFunction.then(function(data) { //here i check some thing and throw an error if (someConditions) { throw new Error('some error'); } return someOtherFunction(); …
Amit
  • 53
  • 7
0
votes
1 answer

Cannot get my promise to return in nodejs / mongoose / bluebird

I'm using bluebird. I've also used bluebird's Promisify for the models. var Promise = require('bluebird'); var mongoose = Promise.promisifyAll(require('mongoose')); var Collection = Promise.promisifyAll(require('../models/collection')); var Vote =…
NoobSter
  • 1,150
  • 1
  • 16
  • 39
0
votes
1 answer

Using bluebird .reflect() to overcome problems with Promise.all()

Lets say there is an array of numbers, periodically with setInterval you need to get and delete first 5 elements and based on those 5 numbers you need to do some async stuff as follows for each of five numbers get something from DB for each record…
Srle
  • 10,366
  • 8
  • 34
  • 63
0
votes
1 answer

Unit test with promise not working

Im using mocha to test my api, the problem is that this function is async and the test suite called before I getting the resutls from the function, how can I overcome this? I try to chain the test like following which raise an error Empty test…
user6124024
0
votes
0 answers

Unhandled rejection MongoError with bluebird.js

I have a MEAN stack application and I am trying to create a user. I am using Bluebird.js as a promise library but I am getting a weird unhandled rejection error although I am catching it. Here is my code: controllers/users.js module.exports = { //…
Sami
  • 5,819
  • 1
  • 23
  • 30
0
votes
2 answers

Why might a node app using Promises not return?

I'm using Bluebird in a CLI app. For some reason, the app is not completing, but I can't fathom why. I've tried running in debug (in Webstorm) and pausing while it's "hung" but I get no information. The code is of the form: Promise.all([ /* promises…
Dancrumb
  • 26,597
  • 10
  • 74
  • 130
0
votes
3 answers

Providing previous values of promises

My question involves promises and providing previous values of chain promises. The question is, is the item passed from first return promise to second promise "runItem --> testItem"? Or do we have to pass the item through all…
puppeteer701
  • 1,225
  • 3
  • 17
  • 33
0
votes
0 answers

how to use bluebird or co coroutines in express router (for yielding controller functions and error handling)?

I what to use features that described here: sync-error-handling-expressjs-es7-promises-generators . I'm writing API for my app, how could i do something like this? I'm trying to find example or some explanations.
1 2 3
99
100