For the complete documentation index, see llms.txt. This page is also available as Markdown.

static defineMessage()

The static "tag" method builds from the given values the error message

CommonError.defineMessage()

The static "tag" method builds from the given values the error message of a string type on the template.

common-error.class.ts
protected static defineMessage(
  templateStringsArray: TemplateStringsArray,
  ...values: any[]
): string {
  let problem: string,
    fix: string,
    id: string | undefined,
    template: string,
    additional: { link?: string; min?: number; max?: number; type?: string };
  [problem, fix, id, template, additional] = values;
  template = (template || CommonError.template)
    .replace('{problem}', problem || '')
    .replace(/{id}/g, id || '')
    .replace(/{link}/g, additional?.link ? additional.link : '')
    .replace(/{max}/g, additional?.max ? String(additional.max) : '')
    .replace(/{min}/g, additional?.min ? String(additional.min) : '')
    .replace(/{type}/g, additional?.type ? additional.type : '')
    .replace('{fix}', fix || '');
  return template;
}

Parameters

templateStringsArray:TemplateStringsArray

-

...values:any[]

A rest parameter of expressions in order ${problem}, ${fix}, ${id}, ${template} and ${additional}.

Returns

The return value is the error message of a string type created from the expressions given in the values.

Example usage

Last updated