Files
umbrix/lib/domain/app/app_failure.dart

23 lines
593 B
Dart
Raw Normal View History

2023-07-27 18:03:41 +03:30
import 'package:freezed_annotation/freezed_annotation.dart';
2023-09-06 12:56:30 +03:30
import 'package:hiddify/core/prefs/prefs.dart';
2023-07-27 18:03:41 +03:30
import 'package:hiddify/domain/failures.dart';
2023-09-12 15:22:58 +03:30
part 'app_failure.freezed.dart';
2023-07-27 18:03:41 +03:30
@freezed
2023-09-12 15:22:58 +03:30
sealed class AppFailure with _$AppFailure, Failure {
const AppFailure._();
2023-07-27 18:03:41 +03:30
2023-09-12 15:22:58 +03:30
const factory AppFailure.unexpected([
2023-07-27 18:03:41 +03:30
Object? error,
StackTrace? stackTrace,
]) = UpdateUnexpectedFailure;
@override
2023-08-26 17:01:51 +03:30
({String type, String? message}) present(TranslationsEn t) {
2023-07-27 18:03:41 +03:30
return switch (this) {
2023-08-26 17:01:51 +03:30
UpdateUnexpectedFailure() => (type: t.failure.unexpected, message: null),
2023-07-27 18:03:41 +03:30
};
}
}