Files
superport/lib/core/errors/exceptions.dart
JiWoong Sul 71b7b7f40b feat: API 연동 개선 및 라이선스 모델 확장
- 라이선스 모델 전면 개편 (상세 필드 추가, 계산 필드 구현)
- API 응답 처리 개선 (HTTP 상태 코드 기반)
- 장비 출고 폼 컨트롤러 추가
- 회사 지점 정보 모델 추가
- 공통 데이터 모델 구조 추가
- 전체 서비스 레이어 API 호출 방식 통일
- UI 컴포넌트 마이너 개선
2025-07-25 01:22:15 +09:00

133 lines
2.7 KiB
Dart

/// 커스텀 예외 클래스들 정의
/// 서버 예외
class ServerException implements Exception {
final String message;
final int? statusCode;
final Map<String, dynamic>? errors;
ServerException({
required this.message,
this.statusCode,
this.errors,
});
@override
String toString() => 'ServerException: $message (code: $statusCode)';
}
/// 캐시 예외
class CacheException implements Exception {
final String message;
CacheException({required this.message});
@override
String toString() => 'CacheException: $message';
}
/// 네트워크 예외
class NetworkException implements Exception {
final String message;
NetworkException({required this.message});
@override
String toString() => 'NetworkException: $message';
}
/// 인증 예외
class UnauthorizedException implements Exception {
final String message;
UnauthorizedException({required this.message});
@override
String toString() => 'UnauthorizedException: $message';
}
/// 유효성 검사 예외
class ValidationException implements Exception {
final String message;
final Map<String, List<String>>? fieldErrors;
ValidationException({
required this.message,
this.fieldErrors,
});
@override
String toString() => 'ValidationException: $message';
}
/// 권한 부족 예외
class ForbiddenException implements Exception {
final String message;
ForbiddenException({required this.message});
@override
String toString() => 'ForbiddenException: $message';
}
/// 리소스 찾을 수 없음 예외
class NotFoundException implements Exception {
final String message;
final String? resourceType;
final String? resourceId;
NotFoundException({
required this.message,
this.resourceType,
this.resourceId,
});
@override
String toString() => 'NotFoundException: $message';
}
/// 중복 리소스 예외
class DuplicateException implements Exception {
final String message;
final String? field;
final String? value;
DuplicateException({
required this.message,
this.field,
this.value,
});
@override
String toString() => 'DuplicateException: $message';
}
/// 비즈니스 로직 예외
class BusinessException implements Exception {
final String message;
final String? code;
BusinessException({
required this.message,
this.code,
});
@override
String toString() => 'BusinessException: $message (code: $code)';
}
/// API 관련 예외
class ApiException implements Exception {
final String message;
final int? statusCode;
final Map<String, dynamic>? errors;
ApiException({
required this.message,
this.statusCode,
this.errors,
});
@override
String toString() => 'ApiException: $message (code: $statusCode)';
}