diff --git a/lib/internal/fs/utils.js b/lib/internal/fs/utils.js index 20d5761376d3ee..1e2bdbcd8823a6 100644 --- a/lib/internal/fs/utils.js +++ b/lib/internal/fs/utils.js @@ -884,17 +884,15 @@ const validateStringAfterArrayBufferView = hideStackFrames((buffer, name) => { const validatePosition = hideStackFrames((position, name) => { if (typeof position === 'number') { - validateInteger(position, 'position'); + validateInteger(position, name); } else if (typeof position === 'bigint') { if (!(position >= -(2n ** 63n) && position <= 2n ** 63n - 1n)) { - throw new ERR_OUT_OF_RANGE('position', + throw new ERR_OUT_OF_RANGE(name, `>= ${-(2n ** 63n)} && <= ${2n ** 63n - 1n}`, position); } } else { - throw new ERR_INVALID_ARG_TYPE('position', - ['integer', 'bigint'], - position); + throw new ERR_INVALID_ARG_TYPE(name, ['integer', 'bigint'], position); } });