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

Use std library errors #745

Closed
rowanseymour opened this issue May 20, 2024 · 4 comments
Closed

Use std library errors #745

rowanseymour opened this issue May 20, 2024 · 4 comments
Assignees

Comments

@rowanseymour
Copy link
Member

rowanseymour commented May 20, 2024

Remove github.com/pkg/errors which is dead like in nyaruka/gocommon#128 and nyaruka/goflow#1258

@rowanseymour
Copy link
Member Author

can use find and replace with regex for some of this...

errors\.Wrap\(err, "([^"]+)"\) > fmt.Errorf("$1: %w", err)

@rowanseymour
Copy link
Member Author

Even better....

errors\.Wrapf?\(err, "([^"]+)"(.*)\)$
fmt.Errorf("$1: %w"$2, err)

@rowanseymour
Copy link
Member Author

BUT... errors.Wrap and errors.Wrapf return nil if passed a nil error... fmt.Errorf doesn't... so you gotta look for cases where we were relying on that. You can find some with ^\treturn fmt\.Errorf\( which are lines returning an err which aren't indented in an if

@norkans7
Copy link
Contributor

Yes, I suspect that is causing issues in backends/rapidpro I will update that part in a second PR

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