static template
A template of the error message
RangeError.template
RangeError.template
A template of the error message of string
type with the replaceable {problem}
, {fix}
and optional {id}
, {max}
, {min}
tags.
By default, it's set to Problem{id}: {problem} => Fix: {fix} between {min} and {max}
.
public static template = `Problem{id}: {problem} must be between {min} and {max} => Fix: {fix}`;
Example usage
// Example usage.
import { RangeError } from '@angular-package/error';
// Change the template.
RangeError.template = `Problem({id}): {problem} => Fix: {fix}`;
// Returns
// RangeError: Problem((AE:427)): The `age` parameter is too big, got 455 => Fix: Set the `age` parameter of the `setAge()` method
new RangeError(
'The `age` parameter is too big, got 455', // Problem
'Set the `age` parameter of the `setAge()` method', // Fix
'(AE:427)', // Identification
9, // Minimum
27 // Maximum range
);
Last updated
Was this helpful?