-
Notifications
You must be signed in to change notification settings - Fork 42
feat: Add rich ErrorData-based error handling with structured error information #1479
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
Conversation
Co-authored-by: krlmlr <[email protected]>
Co-authored-by: krlmlr <[email protected]>
…pdated Co-authored-by: krlmlr <[email protected]>
…or handling Co-authored-by: krlmlr <[email protected]>
@copilot: Add braces when declaring a local variable in the |
Co-authored-by: krlmlr <[email protected]>
I've addressed both parts of your feedback in commit ea70d91:
The error handlers now use a much simpler 3-line approach instead of the previous 15+ lines of DuckDB ErrorData/JSON processing. |
@copilot: Pass two arguments to the R function. Look it up in the duckdb namespace. |
Co-authored-by: krlmlr <[email protected]>
I've updated the error handling implementation in commit 5582edc:
The R function now receives structured arguments and handles the formatting, making the API cleaner and more composable. |
@copilot: Forward calls from rapi_error_with_context to the other overload. Make the function pointer a static local variable. Rename rapi_error to rapi_error_base, create an rlang version that calls rlang::abort() and overwrite with rapi_error_base in .onLoad() if rlang is not installed. |
…add rlang support per feedback Co-authored-by: krlmlr <[email protected]>
I've implemented all the requested changes in commit d06a8e8:
The error handling now has better performance with caching and graceful fallback between rlang and base R. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Fixed compilation error in commit 658cd2d by adding missing [[noreturn]] attributes to the error function implementations to match the header declarations. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
…for safer initialization Co-authored-by: krlmlr <[email protected]>
…atic initialization Co-authored-by: krlmlr <[email protected]>
This is good in principle, but needs more thought:
Let's address this before moving here. |
@copilot: Add a third error handling function that accepts ErrorData and, instead converting the error to JSON, passes this as multiple fields to the R error handlers. Extend the signature of the R error handlers as appropriate, with default |
… R signatures Co-authored-by: krlmlr <[email protected]>
I've implemented the requested changes in commit cfc728a:
The rlang version now provides structured error information with context, error type, raw message, and additional details when available. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Co-authored-by: krlmlr <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Key Changes
Enhanced Error Handling: Added a third
rapi_error_with_context
overload that acceptsduckdb::ErrorData
directly and extracts structured error information including:Improved R Error Functions: Extended both
rapi_error
andrapi_error_rlang
to accept optional parameters for richer error context while maintaining backward compatibility through default NULL values.Direct ErrorData Usage: Replaced JSON error conversion in statement.cpp with direct ErrorData processing to preserve all available error information and context.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.