handleErrorStatusCode method
Implementation
void handleErrorStatusCode(HttpResponse response) {
switch (response.statusCode) {
case 401:
case 404:
throw InvalidCredentials(
"Make sure your credentials from 'todo.json' are correct and valid");
case 503:
throw ServiceUnavaiable("Service unavaiable. Please try again later.");
case 422:
throw SpammedCommand(
"Validation failed or this command was probably spammed");
default:
// TODO(hicaro): improving error reporting for this case
throw UnexpectedError(response.body.toString());
}
}