"An unexpected error was caught" when calling async callback #187

Closed
peterbraden opened this Issue Jan 26, 2012 · 8 comments

Comments

Projects
None yet
9 participants
@peterbraden

this code will trigger:

    require('vows').describe('vows').addBatch({
        'foo' : {
            topic : function(){
        this.callback(1)
            }
            , 'bar' : function(x){
                assert.equal(x, 1)
            }        

        }
    }).run()

gives:

    $ node test.js 
    ✗ 

      foo
        ✗ bar
          » An unexpected error was caught: 1
    ✗ Errored » 1 errored (0.004s)
@pgp44

This comment has been minimized.

Show comment Hide comment
@pgp44

pgp44 Feb 6, 2012

Hello

Not sure this will help you, but I just ran into the same issue. It seems that the callback in some or all cases interprets the first argument as an error. I think if you try

this.callback(null,1)

it might work

Perhaps it helps

Peter

pgp44 commented Feb 6, 2012

Hello

Not sure this will help you, but I just ran into the same issue. It seems that the callback in some or all cases interprets the first argument as an error. I think if you try

this.callback(null,1)

it might work

Perhaps it helps

Peter

@ayoung

This comment has been minimized.

Show comment Hide comment
@ayoung

ayoung Feb 24, 2012

Yeah. Confirmed here in the tests. Someone should update the documentation on the vows website. Very misleading.

ayoung commented Feb 24, 2012

Yeah. Confirmed here in the tests. Someone should update the documentation on the vows website. Very misleading.

@Filirom1

This comment has been minimized.

Show comment Hide comment
@Filirom1

Filirom1 Mar 22, 2012

Contributor

This is a nightmare :

I hate this feature, I lost 30 minutes to find this out :

  "when successful": {
        topic: function () {
            var that = this;
            process.nextTick(function () {
                that.callback(null, "OK");
            });
        },
        "should work like an event-emitter": function (res) {
            assert.equal(res, "OK");
        },
        "should assign `null` to the error argument": function (e, res) {
            assert.strictEqual(e, null);
            assert.equal(res, "OK");
        }
Contributor

Filirom1 commented Mar 22, 2012

This is a nightmare :

I hate this feature, I lost 30 minutes to find this out :

  "when successful": {
        topic: function () {
            var that = this;
            process.nextTick(function () {
                that.callback(null, "OK");
            });
        },
        "should work like an event-emitter": function (res) {
            assert.equal(res, "OK");
        },
        "should assign `null` to the error argument": function (e, res) {
            assert.strictEqual(e, null);
            assert.equal(res, "OK");
        }
@rapaul

This comment has been minimized.

Show comment Hide comment
@rapaul

rapaul Sep 29, 2012

+1

rapaul commented Sep 29, 2012

+1

@adamstallard

This comment has been minimized.

Show comment Hide comment
@adamstallard

adamstallard Jan 23, 2013

Contributor

Proposal for alternative system for error-handling #264.

Contributor

adamstallard commented Jan 23, 2013

Proposal for alternative system for error-handling #264.

@bentaber

This comment has been minimized.

Show comment Hide comment
@bentaber

bentaber Dec 16, 2013

Contributor

+1

Contributor

bentaber commented Dec 16, 2013

+1

@giovannic

This comment has been minimized.

Show comment Hide comment
@giovannic

giovannic May 4, 2014

+1

+1

@indexzero

This comment has been minimized.

Show comment Hide comment
@indexzero

indexzero Nov 4, 2014

Owner

Closing as a duplicate of #264. Adding the "error-handling" label for triage later.

Owner

indexzero commented Nov 4, 2014

Closing as a duplicate of #264. Adding the "error-handling" label for triage later.

@indexzero indexzero closed this Nov 4, 2014

daitangio added a commit to daitangio/org-mode-parser that referenced this issue Jan 9, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment