Jakob Meier 2023-03-17 21:06:23 +01:00
parent fd2e21c328
commit fd1c104e6a
No known key found for this signature in database
GPG key ID: 66BDC7E6A01A6152

29
lib/backend/errors.dart Normal file
View file

@ -0,0 +1,29 @@
/*
* Tool to automatically generate english text from error
*/
String errorAsString(Map<String, dynamic> json) {
switch (json['data']) {
case 'notfound':
return 'Endpoint not found';
case 'wrongstate':
return 'Missing data';
case 'data':
return 'Invalid data';
case 'right':
return 'You are not allowed to perform this action';
case 'server':
return 'Server error';
case 'closed':
return 'Server cannot be reached';
case 'auth':
return 'Username or password wrong';
case 'ota':
return 'Invalid OTA';
case 'existence':
return 'Username unavailable';
case 'config':
return 'Server reached user limit';
}
return "Unknown Error";
}