RangeError 类
- 继承自: <errors.Error>
表示提供的参数不在函数可接受值的集合或范围内;无论是数字范围,还是在给定函数参数的选项集之外。
require('net').connect(-1);
// 抛出 "RangeError: "port" option should be >= 0 and < 65536: -1"
Node.js 将立即生成并抛出 RangeError
实例作为参数验证的一种形式。
- Extends: <errors.Error>
Indicates that a provided argument was not within the set or range of acceptable values for a function; whether that is a numeric range, or outside the set of options for a given function parameter.
require('net').connect(-1);
// Throws "RangeError: "port" option should be >= 0 and < 65536: -1"
Node.js will generate and throw RangeError
instances immediately as a form
of argument validation.