throwException method

void throwException()

Throw exception if status code is not successful.

Implementation

void throwException() {
  switch (this) {
    case StatusCode.OK:
    case StatusCode.CREATED:
    case StatusCode.ACCEPTED:
    case StatusCode.NON_AUTHORITATIVE_INFORMATION:
    case StatusCode.NO_CONTENT:
    case StatusCode.RESET_CONTENT:
    case StatusCode.PARTIAL_CONTENT:
    case StatusCode.MULTI_STATUS:
    case StatusCode.ALREADY_REPORTED:
    case StatusCode.IM_USED:
      break;
    default:
      throw Exception(toString());
  }
}