Skip to content

Commit

Permalink
Merge pull request #298 from recurly/parse_incorrectly_shaped_validat…
Browse files Browse the repository at this point in the history
…ion_errors

Parse incorrectly shaped validation errors
  • Loading branch information
drewish committed Feb 24, 2017
2 parents eeb0d38 + d7ad04f commit b217d6b
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/recurly/response.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,16 @@ public function assertSuccessResponse($object)
if ($trans_error instanceof Recurly_TransactionError && $transaction instanceof Recurly_Transaction)
throw new Recurly_ValidationError($trans_error->customer_message, $transaction, array($trans_error));
}
else
else {
// Here we are making sure that this isn't a ValidationError in the shape of a FieldError
// If it is, we will reshape it into a ValidationError
$error = @$this->parseErrorXml($this->body);
if (isset($error)) {
throw new Recurly_ValidationError('Validation error', $object, array($error));
}
throw new Recurly_ValidationError('Validation error', $object, $object->getErrors());
}

}
}

Expand Down

0 comments on commit b217d6b

Please sign in to comment.