This class encapsulates information about an error to throw if the value supplied by the caller is out of range.
| Name | Type | Description |
|---|---|---|
opt_caller |
function |
optional
The calling function |
opt_val |
number |
optional
The value to check against the range specified by |
opt_range |
Array.<number> |
optional
Values defining the validity range (as [min, max]) |
Example
H.Foo.prototype.bar = function(array, idx) {
if (idx < 0) {
throw new H.lang.OutOfRangeError(
H.Foo.prototype.bar, 2, [0, array.length - 1]);
}
}
new H.Foo().bar(-4, [0, 1]); // ==> 'OutOfRange: H.Foo#bar (-4 out of [0...1])'