errorTypeFromStatusCode function

ErrorType errorTypeFromStatusCode(
  1. int statusCode
)

Implementation

ErrorType errorTypeFromStatusCode(int statusCode) {
  switch (statusCode) {
    case 400:
      return ErrorType.badRequest;
    case 401:
      return ErrorType.unauthorized;
    case 402:
      return ErrorType.paymentRequired;
    case 403:
      return ErrorType.forbidden;
    case 404:
      return ErrorType.notFound;
    case 405:
      return ErrorType.methodNotAllowed;
    case 406:
      return ErrorType.notAcceptable;
    case 500:
      return ErrorType.internalServerError;
    case 501:
      return ErrorType.notImplemented;
    case 502:
      return ErrorType.badGateway;
    default:
      return ErrorType.unknown;
  }
}