Files
admin/_docs/02_document/modules/common_business_exception.md
T
Oleksandr Bezdieniezhnykh c7b297de83
ci/woodpecker/push/01-test Pipeline failed
ci/woodpecker/push/02-build-push unknown status
refactor: remove deploy.cmd and update Dockerfile for health checks
- Deleted the deploy.cmd script as it was no longer needed.
- Updated Dockerfile to include curl for health checks and added a non-root user for improved security.
- Modified health check command to use curl for better reliability.
- Adjusted docker-compose.test.yml to reflect changes in health check configuration.
- Cleaned up appsettings.json and removed unused configuration properties.
- Removed Resource entity and related requests from the codebase as part of the architectural shift.
- Updated documentation to reflect the removal of hardware binding and related endpoints.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-13 08:47:21 +03:00

2.6 KiB

Module: Azaion.Common.BusinessException

Purpose

Custom exception type for domain-level errors, paired with an ExceptionEnum catalog of all business error codes.

Public Interface

BusinessException

Member Signature Description
Constructor BusinessException(ExceptionEnum exEnum) Creates exception with message from ExceptionEnum's [Description] attribute
ExceptionEnum ExceptionEnum ExceptionEnum { get; set; } The specific error code
GetMessage static string GetMessage(ExceptionEnum exEnum) Looks up human-readable message for an error code

ExceptionEnum

Value Code Description
NoEmailFound 10 No such email found
EmailExists 20 Email already exists
WrongPassword 30 Passwords do not match
PasswordLengthIncorrect 32 Password should be at least 12 characters (description text — actual validator threshold is 8 chars per RegisterUserValidator)
EmailLengthIncorrect 35 Email is empty or invalid
WrongEmail 37 (no description attribute)
UserDisabled 38 User account is disabled
WrongResourceName 50 Wrong resource file name
NoFileProvided 60 No file provided

Cycle 1 (2026-05-13) noteHardwareIdMismatch = 40 and BadHardware = 45 were removed by AZ-197 (admin-side hardware-binding cleanup). Code 40 should NOT be reused for a different meaning — older clients may still surface "Hardware mismatch" UX strings keyed on the integer. UserDisabled = 38 was added earlier (still part of the baseline). See _docs/03_implementation/batch_06_report.md.

Internal Logic

Static constructor eagerly loads all ExceptionEnum descriptions into a dictionary via EnumExtensions.GetDescriptions<ExceptionEnum>(). Messages are retrieved by dictionary lookup with fallback to ToString().

Dependencies

  • EnumExtensions — for GetDescriptions<T>()

Consumers

  • BusinessExceptionHandler — catches and serializes to HTTP 409 response
  • UserService — throws for email/password validation failures (NoEmailFound, WrongPassword, EmailExists, UserDisabled)
  • ResourcesService — throws NoFileProvided for missing file uploads
  • FluentValidation validators — reference ExceptionEnum codes in .WithErrorCode()

Data Models

None.

Configuration

None.

External Integrations

None.

Security

Error codes are returned to the client via BusinessExceptionHandler. Codes are numeric and messages are user-facing.

Tests

None.