★ Constructor
The `RangeError` object constructor
RangeError()
Creates the RangeError instance that represents range error with the message built of the given described problem and its solution, optional min/max range, and an explicit identification on the given or stored error message template.
constructor(
problem: string,
fix: string,
id?: Id,
min?: Min,
max?: Max,
template = RangeError.template
) {
super(problem, fix, id, template, { min, max });
this.#max = max;
this.#min = min;
}Parameters
problem:string
Description of the problem of a string type.
fix:string
A solution to the given problem of a string type.
id?:Id
Optional unique identification to the given problem of generic type variable Id.
min?:Min
The optional minimum range of generic type variable Min that causes an error to be thrown(or not thrown).
max?:Max
The optional maximum range of generic type variable Max that causes an error to be thrown(or not thrown).
template:string=RangError.template
Optional template of the error message of string type with the replaceable {problem}, {fix} and optional {id}, {max}, {min} tags. By default, the value is equal to the static property RangeError.template.
Example usage
Last updated