transformApiError method

KakaoException transformApiError (DioError e)

transforms DioError to KakaoException.

Implementation

static KakaoException transformApiError(DioError e) {
  if (e.response == null) return KakaoClientException(e.message);
  if (e.request.baseUrl == "https://${KakaoContext.hosts.kauth}") {
    return KakaoAuthException.fromJson(e.response.data);
  }
  return KakaoApiException.fromJson(e.response.data);
}