Files
slm-design/.templates/business/{{name.kebabCase}}/errors/{{name.kebabCase}}-business.error.ts
2026-08-01 09:31:08 +03:00

22 lines
828 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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
}
}