Files
superport/lib/core/errors/exceptions.dart
JiWoong Sul 2b31d3af5f feat: API 통합을 위한 기초 인프라 구축
- 네트워크 레이어 구현 (Dio 기반 ApiClient)
- 환경별 설정 관리 시스템 구축
- 의존성 주입 설정 (GetIt)
- API 엔드포인트 상수 정의
- 인터셉터 구현 (Auth, Error, Logging)
- 프로젝트 아키텍처 개선 (core, data, di 디렉토리 구조)
- API 통합 계획서 및 요구사항 문서 작성
- 필요 패키지 추가 (dio, flutter_secure_storage, get_it 등)
2025-07-24 14:54:28 +09:00

117 lines
2.4 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)';
}