661cfe2f2c
This commit was created in reaction to the new error messages:
606709ae58/src/api/acts/roomContent.ts
(outbag/server@3686c354c8)
82 lines
2.2 KiB
Dart
82 lines
2.2 KiB
Dart
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 'closed':
|
|
return trans.errorServerClosed;
|
|
case 'bruteforce':
|
|
return trans.errorBruteforce;
|
|
case 'notfound':
|
|
return trans.errorNotFound;
|
|
case 'wrongstate':
|
|
return trans.errorInvalidState;
|
|
case 'data':
|
|
return trans.errorInvalidData;
|
|
case 'right':
|
|
return trans.errorServerPermissions;
|
|
case 'server':
|
|
return trans.errorServer;
|
|
|
|
case 'recursion':
|
|
return trans.errorRemoteRecursion;
|
|
case 'remote':
|
|
return trans.errorRemote;
|
|
|
|
case 'clientnotexists':
|
|
return trans.errorAccountDeletion;
|
|
case 'accountnotexists':
|
|
return trans.errorNoSuchAccount;
|
|
case 'accountexists':
|
|
return trans.errorUsernameTaken;
|
|
case 'roomexists':
|
|
return trans.errorRoomIdTaken;
|
|
case 'roomnotexists':
|
|
return trans.errorNoSuchRoom;
|
|
|
|
case 'membernotexists':
|
|
return trans.errorNoSuchRoomMember;
|
|
case 'memberexists':
|
|
return trans.errorAlreadyInRoom;
|
|
case 'roomlimit':
|
|
return trans.errorReachedRoomLimit;
|
|
case 'roomuserlimit':
|
|
return trans.errorReachedRoomUserLimit;
|
|
case 'roomdatalimit':
|
|
return trans.errorReachedRoomDataLimit;
|
|
case 'notroomadmin':
|
|
return trans.errorRoomPermissions;
|
|
case 'notinroom':
|
|
return trans.errorNotRoomMember;
|
|
case 'owner':
|
|
return trans.errorRoomOwner;
|
|
|
|
case 'catnotexists':
|
|
return trans.errorNoSuchCategory;
|
|
case 'prodnotexists':
|
|
return trans.errorNoSuchProduct;
|
|
case 'itemnotexists':
|
|
return trans.errorNoSuchItem;
|
|
case 'addcat':
|
|
return trans.errorCreatingCategory;
|
|
case 'addprod':
|
|
return trans.errorCreatingProduct;
|
|
case 'additem':
|
|
return trans.errorCreatingItem;
|
|
|
|
case 'config':
|
|
return trans.errorServerConfig;
|
|
case 'ota':
|
|
return trans.errorOTA;
|
|
case 'auth':
|
|
return trans.errorAuth;
|
|
case 'signature':
|
|
return trans.errorInvalidSignature;
|
|
case 'token':
|
|
return trans.errorInvalidToken;
|
|
}
|
|
|
|
return trans.errorUnknown;
|
|
}
|