★ Constructor
The `Error` object constructor
Error()
Error()
Creates the Error
instance with the message built from the given described problem
and its solution, optional explicit identification on the given or stored template
.
constructor(
problem: string,
fix: string,
id?: Id,
template = Error.template
) {
super(problem, fix, id, template);
}
Parameters
problem:
string
problem:
string
Description of the problem of a string
type.
fix:
string
fix:
string
A solution to the given problem
of a string
type.
id?:
Id
id?:
Id
Optional unique identification to the given problem
of generic type variable Id
.
A template of error message with the replaceable {problem}
, {fix}
and optional {id}
tags. By default, the value is equal to the static property template
.
Example usage
// Example usage.
import { Error } from '@angular-package/error';
// Returns "Error: ProblemTE:201: Wrong type => Fix: Change the type".
new Error('Wrong type', 'Change the type', 'TE:201');
Last updated
Was this helpful?