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

Rework Faktory's error handling to include more context #296

Open
3 tasks
mperham opened this issue Apr 20, 2020 · 6 comments
Open
3 tasks

Rework Faktory's error handling to include more context #296

mperham opened this issue Apr 20, 2020 · 6 comments

Comments

@mperham
Copy link
Collaborator

mperham commented Apr 20, 2020

Today Faktory gets errors and naively prints them out, without any sort of context or backtrace. Seeing something like "Socket closed: EOF" gives the user exactly zero information with which to debug.

  • Research how Go errors can be improved.
  • Decide on highest "bang for the buck" improvement we can roll out to the codebase without customizing every single return err block.
  • Roll out to Faktory, Pro and Enterprise.
@gearnode
Copy link
Contributor

gearnode commented Apr 27, 2020

In Go, to have context you have to wrap errors with the %w (since Go 1.13), you have no other real possibility... Go is not customizable as Ruby can be. You can also, create custom Go error struct to add more context on some errors.

E.g.

file, err := OpenFile()
if err != nil {
  return fmt.Errorf("cannot open file: %w", err)
}

I can open pull request with the error wrapping if it can helps.

@mperham
Copy link
Collaborator Author

mperham commented Apr 27, 2020

@gearnode I was thinking we could integrate pkg/errors but I don't know how much value it provides vs error handling in Go 1.13+.

@gearnode
Copy link
Contributor

gearnode commented Apr 27, 2020

Since Go 1.13 the pkg/errors not add a lot of value because Go support error wrapping natively. I not use pkg/errors anymore in my project, since Go add wrapping error supports.

@gearnode
Copy link
Contributor

gearnode commented May 3, 2020

@mperham I send you a first draft git patch if you want some help to wrap errors :)

@mperham
Copy link
Collaborator Author

mperham commented May 3, 2020 via email

@gearnode
Copy link
Contributor

gearnode commented May 3, 2020

My bad I forgot to open the patch :(

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

No branches or pull requests

2 participants