node/test/parallel/test-async-hooks-run-in-async-scope-caught-exception.js
Rich Trott c8e59cbf9e
test: enable no-empty ESLint rule
PR-URL: https://github.com/nodejs/node/pull/41831
Backport-PR-URL: https://github.com/nodejs/node/pull/42160
Refs: https://eslint.org/docs/rules/no-empty
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
2022-03-14 09:32:21 -04:00

11 lines
281 B
JavaScript

'use strict';
require('../common');
const { AsyncResource } = require('async_hooks');
try {
new AsyncResource('foo').runInAsyncScope(() => { throw new Error('bar'); });
} catch {
// Continue regardless of error.
}
// Should abort (fail the case) if async id is not matching.