Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

async_hooks: refactor to use validateObject #46004

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 2 additions & 3 deletions lib/async_hooks.js
Expand Up @@ -24,6 +24,7 @@ const {
const { kEmptyObject } = require('internal/util');
const {
validateFunction,
validateObject,
validateString,
} = require('internal/validators');
const internal_async_hooks = require('internal/async_hooks');
Expand Down Expand Up @@ -276,9 +277,7 @@ const storageHook = createHook({

class AsyncLocalStorage {
constructor(options = kEmptyObject) {
if (typeof options !== 'object' || options === null) {
throw new ERR_INVALID_ARG_TYPE('options', 'Object', options);
}
validateObject(options, 'options');

const { onPropagate = null } = options;
if (onPropagate !== null && typeof onPropagate !== 'function') {
Expand Down