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

More robust error responses #24

Merged
merged 4 commits into from
Apr 14, 2016
Merged

More robust error responses #24

merged 4 commits into from
Apr 14, 2016

Conversation

mattfarina
Copy link
Member

This is a work in progress

@technosophos @sdboyer any feedback?


var (
// ErrWrongVCS is returned when an action is tried on the wrong VCS.
ErrWrongVCS = errors.New("Wrong VCS detected")
Copy link
Member

Choose a reason for hiding this comment

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

Not immediately obvious to me where this would be used. I don't remember all the flows exactly, but isn't this the kind of thing where you'd only encounter this if you try to explicitly use the wrong type on an existing on-disk repo?

Copy link
Member Author

Choose a reason for hiding this comment

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

ErrWrongVCS is an error that exists today. It happens when the type of VCS you already have cloned locally is mismatched with the remote location type. Say the local VCS is bzr and the endpoint is git.

Copy link
Member Author

Choose a reason for hiding this comment

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

Note, this did show up in Glide when folks migrated from Google Code (Hg) to GitHub.

Copy link
Member

Choose a reason for hiding this comment

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

Sorry, totally me just boneheadedly note scrolling far enough down in the diff to see these already existed

- Error types depend if the action is local or remote
- Same error messages from differing VCS
- Underlying error and output are available
@mattfarina mattfarina changed the title [WIP] More robust error responses More robust error responses Apr 13, 2016
@mattfarina
Copy link
Member Author

@technosophos and @sdboyer I made some major changes from the first commit.

  1. Each VCS operation returns the same error text as the other VCS. This means error responses are consistent.
  2. There are RemoteError and LocalError to distinguish a little more. Basically, was there a remote communication or not. I preferred this over a type for each method.
  3. The original error and output string of a command (if there was one) is available on the error. This is useful if you want to output the underlying things or see what was really going on.

If there's any feedback please let me know.

@mattfarina mattfarina merged commit 9f4436d into master Apr 14, 2016
@mattfarina mattfarina deleted the feat/better-errors branch April 14, 2016 13:24
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.

None yet

2 participants