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

feat: improve flight CLI error handling #4873

Merged
merged 1 commit into from
Sep 28, 2023

Conversation

crepererum
Copy link
Contributor

Which issue does this PR close?

-

Rationale for this change

Make error message actually readable:

Before:

thread 'main' panicked at 'collect data stream: Status { code: Internal, message: "h2 protocol error: error reading a body from connection: stream error received: unexpected internal error encountered", source: Some(hyper::Error(Body, Error { kind: Reset(S
treamId(3), INTERNAL_ERROR, Remote) })) }', arrow-flight/src/bin/flight_sql_client.rs:130:14
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

After:

Error: read flight data

Caused by:
    0: collect data stream
    1: status: Internal, message: "h2 protocol error: error reading a body from connection: stream error received: unexpected internal error encountered", details: [], metadata: MetadataMap { headers: {} }
    2: error reading a body from connection: stream error received: unexpected internal error encountered
    3: stream error received: unexpected internal error encountered

What changes are included in this PR?

Use anyhows context instead of expect all over the place.

Note that this ONLY applies to the CLI, not to any library error handling.

Are there any user-facing changes?

Better errors.

**Before:**

```text
thread 'main' panicked at 'collect data stream: Status { code: Internal, message: "h2 protocol error: error reading a body from connection: stream error received: unexpected internal error encountered", source: Some(hyper::Error(Body, Error { kind: Reset(S
treamId(3), INTERNAL_ERROR, Remote) })) }', arrow-flight/src/bin/flight_sql_client.rs:130:14
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
```

**After:**

```text
Error: read flight data

Caused by:
    0: collect data stream
    1: status: Internal, message: "h2 protocol error: error reading a body from connection: stream error received: unexpected internal error encountered", details: [], metadata: MetadataMap { headers: {} }
    2: error reading a body from connection: stream error received: unexpected internal error encountered
    3: stream error received: unexpected internal error encountered
```
@github-actions github-actions bot added arrow Changes to the arrow crate arrow-flight Changes to the arrow-flight crate labels Sep 28, 2023
Copy link
Contributor

@tustvold tustvold left a comment

Choose a reason for hiding this comment

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

I do like anyhow 😄

@tustvold tustvold merged commit 284556e into apache:master Sep 28, 2023
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arrow Changes to the arrow crate arrow-flight Changes to the arrow-flight crate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants