static define()
Defines the `Error` instance.
Error.define()
Error.define()Defines the Error instance with the message built of the given required problem, fix and optional id on the given or stored template.
public static define<Id extends string>(
problem: string,
fix: string,
id?: Id,
template = Error.template
): Error<Id> {
return new this(problem, fix, id, template);
}Generic type variables
A generic type variable constrained by the string, by default of the value captured from the provided optional id indicates the identification type of a new Error instance.
Parameters
problem:string
problem:stringDescription of the problem of a string type.
fix:string
fix:stringA solution to the given problem of a string type.
id?:Id
id?:IdOptional unique identification to the given problem of generic type variable Id.
template =Error.template
template =Error.templateA template of error message with the replaceable {problem}, {fix} and optional {id} tags. By default, the value is equal to the static property template.
Return type
The return type is the Error object that takes generic type variable Id.
Returns
The return value is a new instance of the Error with the message built from the given required problem, fix and optional id on the template.
Example usage
// Example usage.
import { Error } from '@angular-package/error';
// Returns "Error: ProblemTE:201: Wrong type => Fix: Change the type".
Error.define('Wrong type', 'Change the type', 'TE:201');Last updated
Was this helpful?