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

refactor(c/driver_manager): differentiate errors from driver manager #1662

Merged
merged 1 commit into from
Mar 26, 2024

Conversation

lidavidm
Copy link
Member

Fixes #1653.

@github-actions github-actions bot added this to the ADBC Libraries 0.11.0 milestone Mar 25, 2024
@lidavidm lidavidm force-pushed the gh-1653 branch 3 times, most recently from bbff6c1 to e6387b9 Compare March 25, 2024 19:09
@lidavidm lidavidm marked this pull request as ready for review March 25, 2024 19:19
Copy link
Member

@paleolimbot paleolimbot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Would it be appropriate to add tests for at least a few of these cases?

if (!error) return;
if (error->release && error->release != ReleaseError) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it important to be able to reuse an existing error here that was previously initialized by the driver manager? It seems easier to explain to just always initialize a new one (or maybe it is worth explaining in a comment here?)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was preserving the behavior of just appending to an existing error (which admittedly is confusing - I can just get rid of that!)

@@ -696,6 +749,7 @@ AdbcStatusCode AdbcDatabaseGetOption(struct AdbcDatabase* database, const char*
} else {
const auto it = args->options.find(key);
if (it == args->options.end()) {
SetError(error, "Option not found");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is is easy to pass on here which option was not found?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@@ -948,6 +1006,7 @@ AdbcStatusCode AdbcDatabaseRelease(struct AdbcDatabase* database,
AdbcStatusCode AdbcConnectionCancel(struct AdbcConnection* connection,
struct AdbcError* error) {
if (!connection->private_driver) {
SetError(error, "AdbcConnectionCancel: must AdbcConnectionNew first");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
SetError(error, "AdbcConnectionCancel: must AdbcConnectionNew first");
SetError(error, "AdbcConnectionCancel: must call AdbcConnectionNew first");

(...and a few below)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if this diff would be suppressed if it were marked as linguist-generated in .gitattributes (it looks like it is currently linguist-vendored).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll tweak it (though I think it wouldn't take effect until the next PR from what I recall seeing of how GitHub behaves)

@lidavidm lidavidm merged commit e0bdb62 into apache:main Mar 26, 2024
76 checks passed
@lidavidm lidavidm deleted the gh-1653 branch March 26, 2024 19:31
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.

c/driver_manager: clearly tag all errors
2 participants