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

redfish.RedfishConfigError does not implement the error interface #12

Closed
ian-howell opened this issue Feb 10, 2020 · 3 comments
Closed
Assignees
Labels
good first issue Good for newcomers refactor Relates to code refactoring
Projects

Comments

@ian-howell
Copy link
Contributor

Problem description (if applicable)
The current implementation of redfish.RedfishConfigError does not have an Error method, and therefore doesn't implement the error interface. This can be annoying for a user trying to type switch on the error

Proposed change
Implement the Error method on redfish.RedfishConfigError. This error could also benefit from a renaming to more closely match the other errors in airshipctl

@ian-howell ian-howell added the good first issue Good for newcomers label Feb 10, 2020
@ianpittwood ianpittwood added the refactor Relates to code refactoring label Feb 10, 2020
@drewwalters96 drewwalters96 added this to To do in Airship 2.0 via automation Feb 10, 2020
@alexander-hughes
Copy link
Contributor

@ian-howell can you provide more information on this issue?

@alexander-hughes alexander-hughes added the question Further information is requested label Feb 11, 2020
@ian-howell
Copy link
Contributor Author

Sure. Go has a builtin interface called error. Basically, any struct that has the following method:

func (s myStruct) Error() string

implements the error interface, and can be used like a builtin error. That means we can do useful things such as check what kind of error we've received using errors.Is and errors.As.

This issue simply requires adding that method to the redfish error, and as mentioned, renaming it to match the conventions of other errors in airshipctl (e.g. ErrMissingConfig, ErrNotImplemented, etc)

@alexander-hughes alexander-hughes self-assigned this Feb 11, 2020
@alexander-hughes alexander-hughes added wip Work in progress and removed question Further information is requested labels Feb 11, 2020
@alexander-hughes
Copy link
Contributor

Tracking work in Gerrit

airshipbot pushed a commit that referenced this issue Feb 13, 2020
Implement RedfishConfigError
Rename RedfishConfigError to follow airship norms IE ErrRedfish...
Update unit tests

Change-Id: I49051315460b5d261186f32bae6101a752740eae
@alexander-hughes alexander-hughes removed the wip Work in progress label Feb 13, 2020
Airship 2.0 automation moved this from To do to Done Feb 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers refactor Relates to code refactoring
Projects
Airship 2.0
  
Done
Development

No branches or pull requests

3 participants