Files
pnoker 769d1cb977 style: apply repository-wide formatting
- expand single-line Javadocs to multi-line blocks, rewrap Markdown prose, and reflow POM, YAML, and TypeScript formatting
- formatting only: no Java code lines changed, no build-file semantics changed
- verified: backend compile and check_documentation.py pass, pnpm check and pnpm lint:check pass, and the dc3 YAML files parse
2026-08-25 13:35:00 +08:00

3.4 KiB

DC3 Common Exception

Overview

dc3-common-exception defines the standard exception types and exception utility class for the IoT DC3 platform. All services and modules use these exceptions to signal business errors consistently.

Module Information

  • Group ID: io.github.pnoker
  • Artifact ID: dc3-common-exception

Key Components

Exception Types

Exception Usage
ServiceException General service-level business error
BusinessException Business rule violation
UpdateException Entity update failure
AddException Entity add failure
DeleteException Entity delete failure
NotFoundException Entity or resource not found
DuplicateException Duplicate entity conflict
EmptyException Required collection or value is empty
OutRangeException Value outside the allowed range
JsonException JSON serialization/deserialization error
SecurityException General security policy violation
UnAuthorizedException Missing or invalid authentication
AccessDeniedException Authenticated principal lacks access
PasswordChangeRequiredException A password change is enforced
RegisterException Driver/service registration failure
ConnectorException Device connection failure
ReadPointException Point read failure
WritePointException Point write failure
RepositoryException Time-series or storage repository error
RequestException Invalid or rejected request
TypeException Unsupported type conversion
ConfigException Invalid configuration
CronException Invalid cron expression
ImportException Import/export failure
UnSupportException Unsupported operation or protocol
AssociatedException Constraint violation by an association

Utilities

  • ExceptionUtil — Builds shared service-unavailable messages
  • ExceptionMessageFormatter — Internal {} placeholder and trailing-cause formatter used by business exceptions

Shared message constants such as ExceptionConstant belong to dc3-common-constant.

Usage

throw new NotFoundException("Driver not found for device: " + deviceId);
throw new AddException("Failed to add driver: " + entityBO.getServiceName());

Build Instructions

mvn -s .mvn/settings.xml -pl dc3-common/dc3-common-exception -am package

Testing

Run the module tests from the repository root:

mvn -s .mvn/settings.xml -pl dc3-common/dc3-common-exception -am test

Used by all dc3-common-* service modules and dc3-center-* services.