Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add element name to IntuitRequestException and message #609

Merged
merged 1 commit into from
Apr 11, 2024

Conversation

dmorehouse
Copy link

@dmorehouse dmorehouse commented Apr 9, 2024

Have you ever received a field error like "String length specified does not match the supported length" and wondered which of the many fields caused the issue? Me too, this PR changes all that :-)

My proposal makes the element name available in the IntuitRequestException for programatic access to the element name associated with the error message. It also adds the element name if present (it's optional) to the exception message so that messages are prepended with the specific field if present.

Tradeoffs: Adding the element name to the exception message could break existing code if logic was based on the EXACT message returned. Logic based on an exact match instead of an includes would be brittle to message changes from QBO and it's a bad practice to have logic based on error text (especially external party error text). I think it's a good tradeoff to add the element name to the message which is generally used everywhere and by default error messages will now indicate which element they apply to. The message already concatenates the underlying error message and error detail fields and this seemed like very useful context to add to the message by default.

@ruckus ruckus merged commit 9af6e74 into ruckus:2-stable Apr 11, 2024
18 checks passed
@ruckus
Copy link
Owner

ruckus commented Apr 11, 2024

Seems totally reasonable. Thank you @dmorehouse

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants