feat: jellyfin
This commit is contained in:
@@ -1,18 +1,19 @@
|
||||
import '../i18n/strings.g.dart';
|
||||
import 'app_logger.dart';
|
||||
import 'plex_http_exception.dart';
|
||||
import '../exceptions/media_server_exceptions.dart';
|
||||
|
||||
/// Shared helpers for translating network errors into user-friendly messages.
|
||||
String mapHttpErrorToMessage(PlexHttpException error, {required String context}) {
|
||||
String mapHttpErrorToMessage(MediaServerHttpException error, {required String context}) {
|
||||
switch (error.type) {
|
||||
case PlexHttpErrorType.connectionTimeout:
|
||||
case PlexHttpErrorType.receiveTimeout:
|
||||
case MediaServerHttpErrorType.connectionTimeout:
|
||||
case MediaServerHttpErrorType.receiveTimeout:
|
||||
return t.errors.connectionTimeout(context: context);
|
||||
case PlexHttpErrorType.connectionError:
|
||||
case MediaServerHttpErrorType.connectionError:
|
||||
return t.errors.connectionFailed;
|
||||
default:
|
||||
appLogger.e('Error loading $context', error: error);
|
||||
return t.errors.failedToLoad(context: context, error: error.message ?? t.common.unknown);
|
||||
final msg = error.message.isNotEmpty ? error.message : t.common.unknown;
|
||||
return t.errors.failedToLoad(context: context, error: msg);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user