Class: OutOfRangeError
- Last UpdatedMay 21, 2025
- 1 minute read
This class encapsulates information about an error to throw if the value supplied by the caller is out of range.
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])'