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

Proposal: Add Go 1.13 error handling to Error section #334

Closed
ngfgrant opened this issue May 5, 2020 · 5 comments · Fixed by #517
Closed

Proposal: Add Go 1.13 error handling to Error section #334

ngfgrant opened this issue May 5, 2020 · 5 comments · Fixed by #517

Comments

@ngfgrant
Copy link

ngfgrant commented May 5, 2020

Hi thanks for this super site.

I am going through it line by line at the moment and wondered if it would be worth making an addition to the existing Error page? Specifically, the new %w, Unwrap, Is and As methods in error. I don't think the new methods should replace the existing content, only compliment it.

I am happy to contribute the example should this idea be accepted.

@eliben
Copy link
Collaborator

eliben commented May 5, 2020

I think it's a good idea in general, but the devil is in the details. Wrapping errors is a power use, but gobyexample tries to stick to simpler concepts. Detailed discussion can take over a concrete PR, I just wanted to provide some background.

@Omid-SH
Copy link

Omid-SH commented Feb 3, 2021

Hi, I have prepared an answer to the problem, raised in the link below. Hope you enjoy it :)
334

@eliben
Copy link
Collaborator

eliben commented Feb 15, 2021

@Omid-SH consider submitting a PR with a simple example to this repository. That will be easier to review.

@guettli
Copy link
Contributor

guettli commented Mar 16, 2024

Yes, the page about errors could be improved.

I am missing sentinel errors. We use them a lot and use errors.Is() often.

The current state seems to be: Waiting for PR. I hope I can provide one during the next days.

@guettli
Copy link
Contributor

guettli commented Mar 16, 2024

I created PR #517 which adds modern error handling. Please take a look. Feel free to take the PR and adapt it the way you want. Sometimes this is easier than telling me what I should change.

eliben pushed a commit that referenced this issue Mar 21, 2024
Fixes #334

* Add wrapping errors.

Before there was one page about error handling.

Now there are three.

A simple page (the first part of the existing page).

Then a new page about wrapping errors.

And the third page is the second half of the existing page (custom errors).

* ... addressed pr feedback.

* ./tools/build was run.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants