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

cmd/snap-update-ns: improve wording in many errors #5272

Merged
merged 3 commits into from
Jun 7, 2018

Conversation

zyga
Copy link
Collaborator

@zyga zyga commented Jun 6, 2018

This branch contains assorted tweaks for how error handling in snap-update-ns looks like.
I will have more similar patches as I work towards the validation solution but I think this is
okay to propose already.

zyga added 3 commits June 6, 2018 02:43
Many error messages were of the form "cannot create path /full/path:
cannot do stuff to segment "path": real reason for the error". Those
got simplified to just "cannot do stuff to /path/that/failed: real
reason for the error".

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
The target (aka oldname) cannot be empty so we should just check it
internally in the place that creates those symlinks.

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
Attempting to open an unclean paths now provide a more complete and
correct error message than before.

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
@codecov-io
Copy link

Codecov Report

❗ No coverage uploaded for pull request base (master@a49ce5c). Click here to learn what that means.
The diff coverage is 81.25%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master    #5272   +/-   ##
=========================================
  Coverage          ?   78.84%           
=========================================
  Files             ?      500           
  Lines             ?    37477           
  Branches          ?        0           
=========================================
  Hits              ?    29548           
  Misses            ?     5529           
  Partials          ?     2400
Impacted Files Coverage Δ
cmd/snap-update-ns/change.go 100% <100%> (ø)
cmd/snap-update-ns/utils.go 91.87% <80%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a49ce5c...b9f4b4d. Read the comment docs.

Copy link
Contributor

@stolowski stolowski left a comment

Choose a reason for hiding this comment

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

LGTM, with one question.

@@ -116,9 +111,6 @@ func (c *Change) createPath(path string, pokeHoles bool, sec *Secure) ([]*Change
// performed the hole poking and thus additional changes must be nil.
_, err = c.createPath(path, false, sec)
}
} else if err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

That's probably ok and means we will not decorate the error with extra message and just return it as is; is this intended?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, as a part of this change the errors produced by things called by createPath internally now return appropriate error messages by themselves.

Copy link

@jdstrand jdstrand left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks!

@zyga zyga merged commit ef57ff9 into snapcore:master Jun 7, 2018
@zyga zyga deleted the feature/error-cleanups branch June 7, 2018 16:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants