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

Helper to get "root" error #4435

Closed
crepererum opened this issue Nov 30, 2022 · 2 comments · Fixed by #4437
Closed

Helper to get "root" error #4435

crepererum opened this issue Nov 30, 2022 · 2 comments · Fixed by #4437
Labels
enhancement New feature or request

Comments

@crepererum
Copy link
Contributor

Is your feature request related to a problem or challenge? Please describe what you are trying to do.
It would be nice to get the typed "original" error, even when it is wrapped into a chain of ExternalError, ArrowError, Arc etc. The original error could be used to generate HTTP status codes in certain situations, e.g. "resource exhausted".

Describe the solution you'd like

impl DataFusionError {
    /// Get underlying error.
    ///
    /// This may be the same as `self`.
    pub fn find_root(&self) -> &Self {...}
}

Describe alternatives you've considered
String parsing? Sounds like bad code smell.

Additional context
See #4434 for improvements on the error generation. See #3940 for an application.

@crepererum crepererum added the enhancement New feature or request label Nov 30, 2022
@crepererum
Copy link
Contributor Author

FYI: I have an improved implementation of what we have in InfluxDB IOx. It just needs some clean ups and I'll file a PR for that.

@mingmwang
Copy link
Contributor

There was a similar ticket I raised before.

#3410

crepererum added a commit to crepererum/arrow-datafusion that referenced this issue Nov 30, 2022
alamb added a commit that referenced this issue Dec 1, 2022
* feat: `DataFusionError::find_root`

Closes #4435.

* docs: improve

Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>

Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants