xero-ruby icon indicating copy to clipboard operation
xero-ruby copied to clipboard

Differences between has_errors and has_validation_errors

Open mech opened this issue 5 years ago • 3 comments

I find that for Invoice, there is has_errors as well as validation_errors for us to loop through.

Whilst for Contact, it is has_validation_errors as well as validation_errors.

Is there any difference between these 2 and is it possible to be consistent and just use has_validation_errors?

mech avatar Jun 09 '20 06:06 mech

Yes this is something that will be prioritized for upcoming work.

To explain that quickly though - Xero's multiple api sets return mainly validation_errors: [] but a few of the Api sets & endpoints differ a bit. Work will be to normalize error into validation_errors:

SerKnight avatar Jun 25 '20 03:06 SerKnight

Hey @raouldevil wanted to get your eyes across this as it relates to #116

Some of the api sets (payroll, etc) have a different format of the error that comes back. If you can have a quick read through and add any other context I think the work will be related so want to make sure everyone has a chance to vote on output prior to release as this will likely be a breaking change.

SerKnight avatar Jan 22 '21 18:01 SerKnight

@SerKnight I think the above makes sense, as long as there isn't 5 different categories of errors for example. So maybe when the gem raises an exception it has Error: (for authentication and other problems) and Validation Errors: for when something is created or edited. As long as we can easily parse this and pull out information.

raouldevil avatar Jan 25 '21 06:01 raouldevil