1# RangeError
2
3The `Napi::RangeError` class is a representation of the JavaScript `RangeError` that is
4thrown when trying to pass a value as an argument to a function that does not allow
5a range that includes the value.
6
7The `Napi::RangeError` class inherits its behaviors from the `Napi::Error` class (for
8more info see: [`Napi::Error`](error.md)).
9
10For more details about error handling refer to the section titled [Error handling](error_handling.md).
11
12## Methods
13
14### New
15
16Creates a new instance of a `Napi::RangeError` object.
17
18```cpp
19Napi::RangeError::New(Napi::Env env, const char* message);
20```
21
22- `[in] Env`: The environment in which to construct the `Napi::RangeError` object.
23- `[in] message`: Null-terminated string to be used as the message for the `Napi::RangeError`.
24
25Returns an instance of a `Napi::RangeError` object.
26
27### New
28
29Creates a new instance of a `Napi::RangeError` object.
30
31```cpp
32Napi::RangeError::New(Napi::Env env, const std::string& message);
33```
34
35- `[in] Env`: The environment in which to construct the `Napi::RangeError` object.
36- `[in] message`: Reference string to be used as the message for the `Napi::RangeError`.
37
38Returns an instance of a `Napi::RangeError` object.
39
40### Constructor
41
42Creates a new empty instance of a `Napi::RangeError`.
43
44```cpp
45Napi::RangeError::RangeError();
46```
47
48### Constructor
49
50Initializes a `Napi::RangeError` instance from an existing Javascript error object.
51
52```cpp
53Napi::RangeError::RangeError(napi_env env, napi_value value);
54```
55
56- `[in] Env`: The environment in which to construct the `Napi::RangeError` object.
57- `[in] value`: The `Napi::Error` reference to wrap.
58
59Returns an instance of a `Napi::RangeError` object.
60