Skip to content

Commit

Permalink
Fix background() missing return option support
Browse files Browse the repository at this point in the history
  • Loading branch information
kanongil committed Oct 23, 2024
1 parent f6c3b19 commit b751478
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ exports.background = async function (operation, action = 'rethrow', types = 'sys
}
}
catch (err) {
exports[action](err, types, options);
return exports[action](err, types, options);
}
};

Expand Down
13 changes: 13 additions & 0 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,19 @@ describe('Bounce', () => {

Bounce.background(test, 'rethrow', 'system');
});

it('supports the return option', async () => {

const test = async () => {

await Hoek.wait(1);
throw new SyntaxError('Something');
};

const res = await Bounce.background(test(), 'rethrow', 'system', { return: true });
expect(res).to.exist();
expect(res).to.be.an.error(SyntaxError);
});
});

describe('isBoom()', () => {
Expand Down

0 comments on commit b751478

Please sign in to comment.