angular/packages/forms/src/errors.ts
Dylan Hunn f6a096e3d4 fix(forms): Update a Forms validator error to use RuntimeError (#46537)
Replace `new Error()` in a forms Validators function with `RuntimeError`, for better tree-shakability. Also, improve the error messages, and add documentation.

PR Close #46537
2022-06-28 11:32:54 -07:00

25 lines
622 B
TypeScript

/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* The list of error codes used in runtime code of the `forms` package.
* Reserved error code range: 1000-1999.
*/
export const enum RuntimeErrorCode {
// Reactive Forms errors (10xx)
// Basic structure validation errors
NO_CONTROLS = 1000,
MISSING_CONTROL = 1001,
MISSING_CONTROL_VALUE = 1002,
// Validators errors
WRONG_VALIDATOR_RETURN_TYPE = -1101,
// Template-driven Forms errors (11xx)
}