Skip to content
This repository has been archived by the owner on Nov 16, 2017. It is now read-only.

False unhandled rejection #1

Closed
Dashron opened this issue Aug 4, 2015 · 1 comment
Closed

False unhandled rejection #1

Dashron opened this issue Aug 4, 2015 · 1 comment

Comments

@Dashron
Copy link
Owner

Dashron commented Aug 4, 2015

Creating issue for future reference. In certain versions of iojs the following code throws an unhandled rejection error

"use strict";

process.on('unhandledRejection', function(reason, p) {
    console.log("\nUnhandled Rejection at:\n Promise ", p, "\n reason: ", reason);
    throw reason;
});

var coroutine = require('./index.js');

var first = coroutine(function* () {
    yield new Promise(function (resolve, reject) {
        resolve(null);
    });

    return new Promise(function (resolve, reject) {
        reject(new Error('Unauthorized'));
    });
});

first()
.then(function (response) {
    console.log('resp', response);
}, function (err) {
    console.log('err', err);
});
@Dashron
Copy link
Owner Author

Dashron commented Aug 4, 2015

Updating to 2.5.0 fixed the problem for me

@Dashron Dashron closed this as completed Aug 4, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant