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

Simplify API client error handling #1392

Merged
merged 1 commit into from
Feb 27, 2025
Merged

Simplify API client error handling #1392

merged 1 commit into from
Feb 27, 2025

Conversation

csutter
Copy link
Contributor

@csutter csutter commented Feb 27, 2025

The way we handle errors in API clients is a bit too complex, and too coupled to ActiveRecord (it sets model errors, possibly based on trying to parse an error string, and raises its own ClientError).

This changes the clients to not rescue any errors from the remote API, but instead letting them bubble up to the caller, and moves the setting of record errors to the ActiveRecord-specific RemoteSynchronizable concern, paving the way for clients to be able to work with POROs as well.

The way we handle errors in API clients is a bit too complex, and too
coupled to ActiveRecord (it sets model errors, possibly based on trying
to parse an error string, and raises its own `ClientError`).

This changes the clients to not rescue any errors from the remote API,
but instead letting them bubble up to the caller, and moves the setting
of record errors to the ActiveRecord-specific `RemoteSynchronizable`
concern, paving the way for clients to be able to work with POROs as
well.
@csutter csutter merged commit 7f8d2df into main Feb 27, 2025
10 checks passed
@csutter csutter deleted the move-error-setting branch February 27, 2025 16:05
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