static template
A template of the error message of string type with the replaceable tags
CommonError.template
CommonError.template
A template of the error message of string
type with the replaceable {problem}
, {fix}
and optional {id}
, {link}
, {max}
, {min}
, {type}
tags.
public static template = `Problem{id}: {problem} => Fix: {fix}`;
Tags
Replaceable tags on the template
.
{fix}
{fix}
Replaceable by the given required fix
parameter.
{id}
{id}
Replaceable by the given id
parameter.
{link}
{link}
Replaceable by the property link
of the given additional
parameter.
{max}
{max}
Replaceable by the property max
of the given additional
parameter.
{min}
{min}
Replaceable by the property min
of the given additional
parameter.
{problem}
{problem}
Replaceable by the given required problem
parameter.
{type}
{type}
Replaceable by the property type
of the given additional
parameter.
Example usage
// Example usage.
import { CommonError } from '@angular-package/error';
// Change the template.
CommonError.template = `Problem({id}): {problem} => Fix: {fix}`;
// Extend the `CommonError` class.
class TestError<Id extends string> extends CommonError<Id> {}
// Returns
// Error: Problem(AE:427): The `age` parameter is wrong. => Fix: Provided `age`
// must be different type.
new TestError(
'The `age` parameter is wrong.', // Problem
'Provided `age` must be different type. ', // Fix
'AE:427' // Identification
);
Last updated
Was this helpful?