handleError method

dynamic handleError(
  1. DioException e
)

Implementation

dynamic handleError(DioException e) {
  if (e.response != null) {
    // return e.response!.data;
    if (e.response != null) {
      throw Exception(
          "error: ${e.response?.data?["meta"]["code"]} ${e.response?.data?["meta"]["message"]}  : ${e.response?.data?["data"]}");
    } else if (e.message != null) {
      throw Exception(e.message);
    } else {
      throw Exception(e.type);
    }
  } else {
    throw e;
  }
}