msgByStatusCode method
Implementation
String msgByStatusCode(int statusCode) {
switch (statusCode) {
case 400:
return "the request entity sent by your application could not be understood by the server due to malformed syntax (e.g. invalid payload, data type mismatch)";
case 401:
return "there is a problem with the credentials provided by your application. This code indicates that your application tried to operate on a protected resource without providing the proper authorization. It may have provided the wrong credentials or none at all";
case 403:
return "your application is not authorized to access the requested resource, or when your application is being rate limited";
case 404:
return "the resource requested by your application does not exist";
case 405:
return "the HTTP method used by your application is not allowed for the resource";
case 406:
return "the resource requested by your application is not capable of generating response entities that are compliant the Accept headers sent";
case 408:
return "your application did not produce a request within the time that the server was prepared to wait";
case 409:
return "the request sent by your application could not be completed due to a conflict with the current state of the resource";
case 415:
return "the request entity sent by your application is in a format not supported by the requested resource for the requested method";
case 429:
return "your application has made too many calls and has exceeded the rate limit for this service";
case 500:
return "the server encountered an unexpected condition which prevented it from fulfilling the request sent by your application";
case 502:
return "the server encountered an unexpected condition which prevented it from fulfilling the request sent by your application";
case 503:
return "the server is currently unable to handle the request sent by your application due to a temporary overloading or maintenance of the server";
case 504:
return "the server, while acting as a gateway or proxy, did not get a response in time from the upstream server that it needed in order to complete the API call.";
default:
return "success";
}
}