buildErrorResponse function

ParseResponse buildErrorResponse(
  1. ParseResponse response,
  2. ParseNetworkResponse apiResponse
)

Handles any errors returned in response

Implementation

ParseResponse buildErrorResponse(
    ParseResponse response, ParseNetworkResponse apiResponse) {
  final Map<String, dynamic> responseData = json.decode(apiResponse.data);
  response.error = ParseError(
      code: responseData[keyCode] ?? ParseError.otherCause,
      message: responseData[keyError].toString());
  response.statusCode = responseData[keyCode] ?? ParseError.otherCause;
  return response;
}