Skip to content

Properly handle errors - #132

Merged
mattfarina merged 7 commits into
Masterminds:masterfrom
nrvnrvn:properly-handle-errors
Sep 30, 2019
Merged

mattfarina merged 7 commits into
Masterminds:masterfrom
nrvnrvn:properly-handle-errors

Conversation

@nrvnrvn

@nrvnrvn nrvnrvn commented Dec 12, 2018

Copy link
Copy Markdown
Contributor
  • tried to satisfy the god of linters;
  • replaced explicit and "inherited" panics with error returns (fixes Replace panics with errors? #125), this actually makes much more sense;
  • introduced new functions: mustDateModify, mustToDate, mustToJson, mustToPrettyJson, mustMerge (fixes Silently omitting errors #115);
  • replaced type cast functions with spf13/cast to DRY and not re-invent anything. If for some reason you find this change should be reverted please let me know

@nrvnrvn

nrvnrvn commented Jan 12, 2019

Copy link
Copy Markdown
Contributor Author

@mattfarina @technosophos
hey guys! Could you please take a look?

@technosophos

Copy link
Copy Markdown
Member

I am torn on this PR because it fixes a number of things that I think need to be fixed, but it significantly changes the public API -- which means we'd have to rev the major version number.

Thoughts, @mattfarina ?

@mattfarina

Copy link
Copy Markdown
Member

I want to think through the idea of incrementing the major version. Here is a list of public packages that use sprig. I'm sure this isn't complete as everything doesn't land in godoc.

When I look at the list I wonder about the impact to Traefik, OpenShift, the things Rancher is doing, and others. Is this change worth incrementing the public API for them? Is there another set of public API changes we might want to make to increase the value of changing the API?

I also got to learn about https://www.runatlantis.io/ by looking at who uses it.

@mattfarina mattfarina mentioned this pull request Sep 27, 2019
@mattfarina
mattfarina merged commit f3c0fa5 into Masterminds:master Sep 30, 2019
@mattfarina

Copy link
Copy Markdown
Member

@nrvnrvn I pulled your commits into #189 and then made some changes. The public Go API is no longer changed. There are now two sets of functions. Those with the previous behavior and those prefixed with must for the errors following the pattern you started. There are people who want it both ways so we were looking to do that.

This was automatically marked as merged because the commits were merged.

Thanks for the work.

@nrvnrvn

nrvnrvn commented Sep 30, 2019

Copy link
Copy Markdown
Contributor Author

Thanks a lot @mattfarina

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.

Replace panics with errors? Silently omitting errors

3 participants