HttpException(int statusCode, [body])

Source

factory HttpException(int statusCode, [body]) {
  if (statusCode == 400) return new HttpBadRequestException(body);
  if (statusCode == 401) return new HttpUnauthorizedException(body);
  if (statusCode == 402) return new HttpPaymentRequiredException(body);
  if (statusCode == 403) return new HttpForbiddenException(body);
  if (statusCode == 404) return new HttpNotFoundException(body);
  if (statusCode == 405) return new HttpMethodNotAllowedException(body);
  if (statusCode == 406) return new HttpNotAcceptableException(body);
  if (statusCode == 407) return new HttpProxyAuthenticationRequiredException(body);
  if (statusCode == 408) return new HttpRequestTimeoutException(body);
  if (statusCode == 409) return new HttpConflictException(body);
  if (statusCode == 410) return new HttpGoneException(body);
  if (statusCode == 411) return new HttpLengthRequiredException(body);
  if (statusCode == 412) return new HttpPreconditionFailedException(body);
  if (statusCode == 413) return new HttpPayloadTooLargeException(body);
  if (statusCode == 414) return new HttpURITooLongException(body);
  if (statusCode == 415) return new HttpUnsupportedMediaTypeException(body);
  if (statusCode == 416) return new HttpRangeNotSatisfiableException(body);
  if (statusCode == 417) return new HttpExpectationFailedException(body);
  if (statusCode == 418) return new HttpImATeapotException(body);
  if (statusCode == 419) return new HttpAuthenticationTimeoutException(body);
  if (statusCode == 421) return new HttpMisdirectedRequestException(body);
  if (statusCode == 422) return new HttpUnprocessableEntityException(body);
  if (statusCode == 423) return new HttpLockedException(body);
  if (statusCode == 424) return new HttpFailedDependencyException(body);
  if (statusCode == 426) return new HttpUpgradeRequiredException(body);
  if (statusCode == 428) return new HttpPreconditionRequiredException(body);
  if (statusCode == 429) return new HttpTooManyRequestsException(body);
  if (statusCode == 431) return new HttpRequestHeaderFieldsTooLargeException(body);
  if (statusCode == 500) return new HttpInternalServerErrorException(body);
  if (statusCode == 501) return new HttpNotImplementedException(body);
  if (statusCode == 502) return new HttpBadGatewayException(body);
  if (statusCode == 503) return new HttpServiceUnavailableException(body);
  if (statusCode == 504) return new HttpGatewayTimeoutException(body);
  if (statusCode == 505) return new HttpVersionNotSupportedException(body);
  if (statusCode == 506) return new HttpVariantAlsoNegotiatesException(body);
  if (statusCode == 507) return new HttpInsufficientStorageException(body);
  if (statusCode == 508) return new HttpLoopDetectedException(body);
  if (statusCode == 510) return new HttpNotExtendedException(body);
  if (statusCode == 511) return new HttpNetworkAuthenticationRequiredException(body);
  return new HttpException._(statusCode, body);
}