mirror of
https://github.com/gromlab-ru/slm-design.git
synced 2026-08-22 07:30:16 +03:00
feat: add example
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
import type { {{name.pascalCase}}ErrorCode } from '../types/{{name.kebabCase}}-error-code.type'
|
||||
|
||||
/**
|
||||
* Доменная ошибка бизнес-модуля {{name.pascalCase}}.
|
||||
*
|
||||
* UI/i18n-слой должен использовать `code`, а не `message`, для выбора пользовательского текста.
|
||||
*/
|
||||
export class {{name.pascalCase}}BusinessError extends Error {
|
||||
/** Код доменной ошибки для UI/i18n-слоя. */
|
||||
readonly code: {{name.pascalCase}}ErrorCode
|
||||
/** Исходная ошибка нижележащей runtime-зависимости. */
|
||||
readonly cause: unknown
|
||||
|
||||
constructor(code: {{name.pascalCase}}ErrorCode, cause: unknown) {
|
||||
super(code)
|
||||
|
||||
this.name = '{{name.pascalCase}}BusinessError'
|
||||
this.code = code
|
||||
this.cause = cause
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user