handleException method

Exception handleException()

Implementation

Exception handleException() {
  switch (this) {
    case 401:
      return UnauthorizedException();
    case 404:
      return NotFoundException();
    case 500:
    case 501:
    case 502:
    case 503:
    case 504:
      return ServerErrorException();
    default:
      return SomethingWentWrongException();
  }
}