-
Notifications
You must be signed in to change notification settings - Fork 1
패턴 및 규칙(Result, AppException...) ⭐️
Okhyeon Kim edited this page Apr 25, 2025
·
1 revision
@freezed
sealed class Result<T> with _$Result<T> {
const factory Result.success(T data) = Success<T>;
const factory Result.error(Failure failure) = Error<T>;
}
@freezed
sealed class AppException with _$AppException implements Exception {
const AppException._();
const factory AppException.network({
required String message,
Object? error,
StackTrace? stackTrace,
}) = NetworkException;
const factory AppException.api({
required String message,
int? statusCode,
Object? error,
StackTrace? stackTrace,
}) = ApiException;
const factory AppException.parsing({
required String message,
Object? error,
StackTrace? stackTrace,
}) = ParsingException;
const factory AppException.database({
required String message,
Object? error,
StackTrace? stackTrace,
}) = DatabaseException;
//...
}