actions-test/lib/backend/errors.dart

31 lines
737 B
Dart
Raw Normal View History

/*
* 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 'roomAdmin':
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";
}