# static template

## `CommonError.template`

A template of the error message of [`string`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) type with the replaceable [`{problem}`](https://error.angular-package.dev/constructor#problem), [`{fix}`](https://error.angular-package.dev/constructor#fix) and optional [`{id}`](#id), [`{link}`](#link), [`{max}`](#max), [`{min}`](#min), [`{type}`](#type) tags.

{% hint style="info" %}
By default, it's set to:

`Problem{id}: {problem} => Fix: {fix}`.
{% endhint %}

{% code title="common-error.class.ts" %}

```typescript
public static template = `Problem{id}: {problem} => Fix: {fix}`;
```

{% endcode %}

### Tags

Replaceable tags on the [`template`](#template-string-commonerror.template).

#### `{fix}`

Replaceable by the given required [`fix`](https://error.angular-package.dev/constructor#fix-string) parameter.

#### `{id}`

Replaceable by the given [`id`](https://error.angular-package.dev/constructor#id-id) parameter.

#### `{link}`

Replaceable by the property `link` of the given [`additional`](https://error.angular-package.dev/constructor#additional-min-number-max-number-type-string) parameter.

#### `{max}`

Replaceable by the property `max` of the given [`additional`](https://error.angular-package.dev/constructor#additional-min-number-max-number-type-string) parameter.

#### `{min}`

Replaceable by the property `min` of the given [`additional`](https://error.angular-package.dev/constructor#additional-min-number-max-number-type-string) parameter.

#### `{problem}`

Replaceable by the given required [`problem`](https://error.angular-package.dev/constructor#problem-string) parameter.

#### `{type}`

Replaceable by the property `type` of the given [`additional`](https://error.angular-package.dev/constructor#additional-min-number-max-number-type-string) parameter.

## Example usage

```typescript
// 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
);
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://error.angular-package.dev/commonerror/properties/static-template.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
