It's actually a conscious design choice in vows, but I agree that it's a 
mistake. In the async case (last time I checked) it looks at the arity of 
your vow function (function.length), and if it takes less than two 
arguments, it assumes that you don't want the error passed to your 
function, just the "result", and that you want to classify it as an error 
every time an error is passed to this.callback.

I guess the underlying assumption is that an async function will always 
deliver a result to its callback, but it's clearly too magic. It has caused 
a lot of wtfs for me and my team. The "fix" is to add a bogus 2nd argument 
to your vow function.

Best regards,
Andreas Lind Petersen (papandreou)

On Sunday, November 4, 2012 12:07:59 PM UTC+1, Alberto Gori wrote:
>
> I discovered that the problem is not inherent to mongoose validation 
> method, but to vows. Incredibly vows fails to manage Error in callback. For 
> example:
>
>
> 'this model': {
>     topic: function() {this.callback(new Error('error!!!'))}
>     'should throw an error': function(e) {asser.ok(e);}
> }
>
> this very simple test fails with 
>
>  ยป An unexpected error was caught: Error: error! 
>
> I thought vows was a solid test library...what happened?
>

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to