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: Minor improvements to error visibility #230

Merged
merged 3 commits into from
Feb 6, 2024

Conversation

einarmo
Copy link
Contributor

@einarmo einarmo commented Jan 23, 2024

This PR makes a few small changes:

  • Changes the derived display impl of BackoffError to also include the source error.
  • Removes a few unhelpful TODO's, which are no longer correct.
  • Exposes connection::Error as ConnectionError. Currently it is not visible at all, since connection is a private module.
  • Captures errors from broker connection and passes that along too.

Nothing should be breaking or particularly intrusive.

  • I've read the contributing section of the project CONTRIBUTING.md.
  • Signed CLA (if not already signed).

// errors should always contain at least 1 element here.
let errors_string = errors
.into_iter()
.map(|e| e.to_string())
Copy link
Collaborator

Choose a reason for hiding this comment

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

I suggest you create a helper type here to delay the error formatting until it is actually needed:

struct MultiError(Vec<Box<dyn std::error::Error + Send + Sync>);

impl std::error::Error for MultiError {...}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, that's probably better. Maybe it would even be more useful with

struct MultiError<T: std::error::Error + Send + Sync + 'static>(Vec<T>)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Though since we're sticking it in a Box<dyn ...> anyway I guess it doesn't make much of a difference in this case.

@crepererum crepererum changed the title Minor improvements to error visibility refactor: inor improvements to error visibility Jan 23, 2024
@crepererum
Copy link
Collaborator

tests need a fix and the commit message shall follow Conventional Commits (just prefix it with refactor: )

This commit also removes a few unhelpful comments that are no longer
correct.
@einarmo
Copy link
Contributor Author

einarmo commented Jan 23, 2024

I have three separate commits, as they are technically three separate changes, but I'll squash them if you prefer. Also, I think technically they are features, since they are visible to users.

@einarmo einarmo changed the title refactor: inor improvements to error visibility feat: Minor improvements to error visibility Jan 23, 2024
@crepererum crepererum added the automerge Instruct kodiak to merge the PR label Feb 6, 2024
@kodiakhq kodiakhq bot merged commit 1b1c220 into influxdata:main Feb 6, 2024
12 checks passed
@crepererum
Copy link
Collaborator

Thank you and sorry for the review delay.

@einarmo einarmo deleted the backoff-log-source branch February 6, 2024 16:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge Instruct kodiak to merge the PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants