> For the complete documentation index, see [llms.txt](https://docs.angular-package.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.angular-package.dev/error/validationerror/overview.md).

# Overview

## `ValidationError {}`

The `ValidationError` object is an extension of the [`CommonError`](/error/commonerror/overview.md) class and is thrown when an operation could not be performed despite proper type(but not exclusively) with the [message](/error/commonerror/accessors/get-message.md) built from the described problem and its solution, along with additional identification on the given or stored template.

{% embed url="<https://github.com/angular-package/error/blob/main/src/lib/validation-error.class.ts>" %}
`validation-error.class.ts`
{% endembed %}

### Accessors

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| <p><strong>public get</strong> <a href="/pages/krAJfnoPdPcqEFpX1jEM"><strong>name()</strong></a><strong>: </strong><mark style="color:green;"><strong>string</strong></mark><br>The <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/get"><code>get</code></a> accessor obtains error name of a <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String"><code>string</code></a> type, set to <code>'ValidationError'</code> that is being thrown.</p>                                                                                                                                                                                                                                         |
| <p><strong>public get</strong> <a href="/pages/kzpwqWHtfofxn0KrRnu1"><strong>[Symbol.</strong><mark style="color:blue;"><strong>toStringTag</strong></mark><strong>](https://docs.angular-package.dev/error/validationerror)</strong></a><strong>: </strong><mark style="color:green;"><strong>string</strong></mark><br>The <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/get"><code>get</code></a> accessor, with the help of <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/toStringTag"><code>toStringTag</code></a>, changes the default tag to <code>'ValidationError'</code> for an instance of <a href="/pages/tWJbBkEAjqz0Kp1KEc0j"><code>ValidationError</code></a>.</p> |

### Methods

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| <p><strong>public static</strong> <a href="/pages/7leXTDQtmSrFMwpWvEW1"><strong>define()</strong></a><strong>: </strong><mark style="color:green;"><strong>ValidationError</strong></mark><strong><</strong><mark style="color:green;"><strong>Id</strong></mark><strong>></strong><br>Defines the <a href="/pages/tWJbBkEAjqz0Kp1KEc0j"><code>ValidationError</code></a> instance with the <a href="/pages/UAsNmVmOuYGxNypELFFh">message</a> built of the given required <a href="/pages/7leXTDQtmSrFMwpWvEW1#problem-string"><code>problem</code></a>, <a href="/pages/7leXTDQtmSrFMwpWvEW1#fix-string"><code>fix</code></a> and optional <a href="/pages/7leXTDQtmSrFMwpWvEW1#id-id"><code>id</code></a> on the supplied or stored <a href="/pages/7leXTDQtmSrFMwpWvEW1#template-validationerror.template"><code>template</code></a>.</p> |
| <p><strong>public static</strong> <a href="/pages/GuKlSXtxySYdT8X2Oumq"><strong>isValidationError()</strong></a><strong>: value is </strong><mark style="color:green;"><strong>ValidationError</strong></mark><strong><</strong><mark style="color:green;"><strong>Id</strong></mark><strong>></strong><br>Checks whether the <a href="/pages/GuKlSXtxySYdT8X2Oumq#value-any"><code>value</code></a> of any type is the <a href="/pages/tWJbBkEAjqz0Kp1KEc0j"><code>ValidationError</code></a> instance of any or the given <a href="/pages/GuKlSXtxySYdT8X2Oumq#id-id">identification</a>.</p>                                                                                                                                                                                                                                              |
