How to use the ifError function from assert-plus

Find comprehensive JavaScript assert-plus.ifError code examples handpicked from public code repositorys.

973
974
975
976
977
978
979
980
981
982
983


/**
 * Like ftw(3) - performs a `find` operation.
 *
 * client.ftw('/', function (err, res) {
 *     assert.ifError(err);
 *
 *     res.on('entry', function (obj) {
 *         console.log(obj);
 *     });
fork icon41
star icon75
watch icon0

+ 13 other calls in file

121
122
123
124
125
126
127
128
129
130
131
    }
}


exports.setUp = function (callback) {
    common.setUp(function (err, _client) {
        assert.ifError(err);
        assert.ok(_client, 'restify client');
        client = _client;
        callback();
    });
fork icon20
star icon11
watch icon0

383
384
385
386
387
388
389
390
391
392
*        client.getUser('admin', function (err, user) {
*            assert.ifError(err);
*
*            // Note the user object has its own methods
*            user.listKeys(function (err2, keys) {
*                assert.ifError(err2);
*
*                keys.forEach(function (k) {
*                    log.debug({
*                        user: user.login,
fork icon9
star icon3
watch icon0

+ 3 other calls in file

39
40
41
42
43
44
45
46
47
 */
req.on('end', function collectMetrics() {
    vasync.parallel({funcs: preCollectFuncs}, function _onPreCollected(
        preCollectErr
    ) {
        assert.ifError(
            preCollectErr,
            'preCollectFuncs should not callback with error'
        );
fork icon3
star icon0
watch icon0