2023-07-06 17:18:41 +03:30
|
|
|
import 'package:freezed_annotation/freezed_annotation.dart';
|
|
|
|
|
import 'package:hiddify/core/locale/locale.dart';
|
|
|
|
|
import 'package:hiddify/domain/failures.dart';
|
|
|
|
|
|
|
|
|
|
part 'profiles_failure.freezed.dart';
|
|
|
|
|
|
|
|
|
|
@freezed
|
|
|
|
|
sealed class ProfileFailure with _$ProfileFailure, Failure {
|
|
|
|
|
const ProfileFailure._();
|
|
|
|
|
|
|
|
|
|
const factory ProfileFailure.unexpected([
|
|
|
|
|
Object? error,
|
|
|
|
|
StackTrace? stackTrace,
|
|
|
|
|
]) = ProfileUnexpectedFailure;
|
|
|
|
|
|
|
|
|
|
const factory ProfileFailure.notFound() = ProfileNotFoundFailure;
|
|
|
|
|
|
2023-08-19 22:27:23 +03:30
|
|
|
const factory ProfileFailure.invalidConfig([String? message]) =
|
|
|
|
|
ProfileInvalidConfigFailure;
|
2023-07-06 17:18:41 +03:30
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
String present(TranslationsEn t) {
|
|
|
|
|
return switch (this) {
|
|
|
|
|
ProfileUnexpectedFailure() => t.failure.profiles.unexpected,
|
|
|
|
|
ProfileNotFoundFailure() => t.failure.profiles.notFound,
|
|
|
|
|
ProfileInvalidConfigFailure() => t.failure.profiles.invalidConfig,
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|