-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
libct/error.go: rm ConfigError (alt) #3176
libct/error.go: rm ConfigError (alt) #3176
Conversation
@@ -52,7 +52,7 @@ func (v *ConfigValidator) Validate(config *configs.Config) error { | |||
} | |||
for _, c := range warns { | |||
if err := c(config); err != nil { | |||
logrus.WithError(err).Warnf("invalid configuration") | |||
logrus.WithError(err).Warn("invalid configuration") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Technically it doesn't belong here; let me remove it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moved to the first commit
All the errors returned from Validate should tell about a configuration error. Some were lacking a context, so add it. While at it, fix abusing fmt.Errorf and logrus.Warnf where the argument do not contain %-style formatting. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
ConfigError was added by commit e918d02, while removing runc own error system, to preserve a way for a libcontainer user to distinguish between a configuration error and something else. The way ConfigError is implemented requires a different type of check (compared to all other errors defined by error.go). An attempt was made to rectify this, but the resulting code became even more complicated. As no one is using this functionality (of differentiating a "bad config" type of error from other errors), let's just drop the ConfigError type. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
1ea77a6
to
538ba84
Compare
Setting 1.1.0 milestone as I'd like this refactoring (which changes libcontainer API) to be over before 1.1.0 one way or another. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
thanks!
This is the alternative to #3056, addressing review comment from #3033 (comment).
ConfigError
type was added by commit e918d02, while removing runc'sown error system, to preserve a way for a libcontainer user to distinguish
between a configuration error and something else.
The way ConfigError is implemented requires a different type of check
(compared to all other errors defined by error.go). An attempt was made
to rectify this, but the resulting code became even more complicated.
As no one is using this functionality (of differentiating a "bad config"
type of error from other errors), let's just drop the ConfigError type.