actions-test/lib/backend/errors.dart

33 lines
840 B
Dart
Raw Normal View History

import 'package:flutter_gen/gen_l10n/app_localizations.dart';
/*
* Tool to automatically generate english text from error
*/
String errorAsString(Map<String, dynamic> json, AppLocalizations trans) {
switch (json['data']) {
case 'notfound':
return trans.errorNotFound;
case 'wrongstate':
return trans.errorDataIncomplete;
case 'data':
return trans.errorDataInvalid;
case 'roomAdmin':
case 'right':
return trans.errorPermissions;
case 'server':
return trans.errorServer;
case 'closed':
return trans.errorUnreachable;
case 'auth':
return trans.errorAuth;
case 'ota':
return trans.errorInvalidOTA;
case 'existence':
return trans.errorUsernameUnavailable;
case 'config':
return trans.errorServerLimit;
}
return trans.errorUnknown;
}