29 lines
937 B
Dart
29 lines
937 B
Dart
import '../../errors/app_exception.dart';
|
|
|
|
class RmvUpstreamException extends AppException {
|
|
final String? errorCode;
|
|
|
|
RmvUpstreamException({required this.errorCode, super.technicalDetails})
|
|
: super(userMessage: _mapMessage(errorCode), allowRetry: true);
|
|
|
|
static String _mapMessage(String? code) {
|
|
switch (code) {
|
|
case 'H390':
|
|
return 'Keine Verbindung gefunden.';
|
|
case 'H891':
|
|
return 'Eine der angegebenen Stationen ist ungültig.';
|
|
case 'H895':
|
|
return 'Start- und Zielhaltestelle sind identisch.';
|
|
case 'H900':
|
|
case 'H892':
|
|
return 'Die Fahrplanauskunft ist gerade nicht verfügbar.';
|
|
case 'H910':
|
|
return 'Die angegebene Zeit liegt außerhalb des Fahrplans.';
|
|
case null:
|
|
return 'Die Fahrplanauskunft konnte keine Antwort liefern.';
|
|
default:
|
|
return 'Die Fahrplanauskunft hat einen Fehler gemeldet ($code).';
|
|
}
|
|
}
|
|
}
|