qassert.js
// note that if throws() fails to match it rethrows the user-provided thrown item, which need not be an Error
note that if throws() fails to match it rethrows the user-provided thrown item, which need not be an Error
note that if throws () fails to match it rethrows the user - provided thrown item which need not be an Error
function annotateError( err, appendToMessage, altMessage ) {
    if (err instanceof assert.AssertionError) {
        var msg = findFirst([err.message, altMessage, (err.actual + ' ' + err.operator + ' ' + err.expected)]);
        var annotatedMsg = msg + (appendToMessage ? ': ' + appendToMessage : '');
        err.stack = err.stack && err.stack.replace(msg, annotatedMsg);
        err.message = annotatedMsg;
    }
    return err;
}
function annotateError ( err , appendToMessage , altMessage ) { if ( err instanceof assert . AssertionError ) { var msg = findFirst ( [ err . message , altMessage , ( err . actual + ' ' + err . operator + ' ' + err . expected ) ] ) ; var annotatedMsg = msg + ( appendToMessage ? ': ' + appendToMessage : '' ) ; err . stack = err . stack && err . stack . replace ( msg , annotatedMsg ) ; err . message = annotatedMsg ; } return err ; }
note that if throws() fails to match it rethrows the user-provided thrown item, which need not be an Error
note that if throws () fails to match it rethrows the user - provided thrown item which need not be an Error
// some node-v0.8 errors do not populate err.message?? if so, supply the canonical // (the canonical message or altMessage will not be in the stack trace, so ok to use in replace) // err.code = findFirst([err.code, 'ERR_ASSERTION']); // TBD: ensure err.code set, even on older nodejs