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

basichost / blankhost: wrap errors #2331

Merged
merged 1 commit into from
Jun 27, 2023

Conversation

Wondertan
Copy link
Contributor

@Wondertan Wondertan commented Jun 5, 2023

The goal here is to improve the experience of working with errors returned by the Host. With the current state, it's PITA to debug exactly what went wrong during a stream open and this feat attempts to solve it.

  • Inspired by errors in std net.
  • I wanted to improve the RoutedHost as well, but I will wait until you migrate to v1.20, as I need errors.Join
  • I am open to any other suggestions on how to make this even better
  • Can we include this in 0.28? 🙏🏻 🙏🏻 🙏🏻

Closes #2334

@marten-seemann
Copy link
Contributor

I’m ok with the error wrapping changes introduced here. I’d like to be a little bit more careful about introducing a new error type here. Not saying that it’s a bad idea, but I’d prefer to have an issue and an API discussion first.

@Wondertan
Copy link
Contributor Author

I’d prefer to have an issue and an API discussion first.

My toxic trait is coming up with contributions out of nowhere 😄.

Ok, let's make an issue!

@Wondertan
Copy link
Contributor Author

Any chance you can take a look at this?

@marten-seemann
Copy link
Contributor

I’m ok with the error wrapping changes introduced here.

I already reviewed this PR. Let me know once you've updated it.

@Wondertan
Copy link
Contributor Author

Ok, it wasn't clear whether changes were requested or not

@Wondertan
Copy link
Contributor Author

Updated to keep wrappings only

Copy link
Contributor

@marten-seemann marten-seemann left a comment

Choose a reason for hiding this comment

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

... and so on for the other errors.

p2p/host/basic/basic_host.go Outdated Show resolved Hide resolved
p2p/host/basic/basic_host.go Outdated Show resolved Hide resolved
p2p/host/basic/basic_host.go Outdated Show resolved Hide resolved
p2p/host/basic/basic_host.go Outdated Show resolved Hide resolved
@Wondertan
Copy link
Contributor Author

A user would usually wrap the error with "failed" or the log would also say that error, but I don't feel strongly about it, so applied.

Copy link
Contributor

@marten-seemann marten-seemann left a comment

Choose a reason for hiding this comment

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

@Wondertan Any reason you only changed ~half of the error messages?

@marten-seemann marten-seemann changed the title feat(host): Error basichost / blankhost: wrap errors Jun 15, 2023
@Wondertan
Copy link
Contributor Author

@Wondertan Any reason you only changed ~half of the error messages?

I simply applied all the comments

@Wondertan
Copy link
Contributor Author

Fixed now

Copy link
Contributor

@marten-seemann marten-seemann left a comment

Choose a reason for hiding this comment

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

Thank you @Wondertan!

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.

Errors returned by Host methods should be more descriptive
2 participants