-
Notifications
You must be signed in to change notification settings - Fork 93
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
Ignore inaccessible config file unless its path was specified as --config=... #312
Ignore inaccessible config file unless its path was specified as --config=... #312
Conversation
3e53d24
to
637165d
Compare
Moved the new error definitions to |
637165d
to
b9f6efa
Compare
include/libdnf/common/exception.hpp
Outdated
using Error::Error; | ||
const char * get_domain_name() const noexcept override { return "libdnf::base"; } | ||
const char * get_name() const noexcept override { return "InvalidConfigError"; } | ||
}; |
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.
It seems to me that these specific errors do not fit in this header file where more general errors are defined.
include/libdnf/conf/config_parser.hpp
might be a better fit for them, what do you think?
After all, config parser is the place where these exceptions have their roots. Maybe, they can be even handled / thrown directly in the ConfigParser::read()
?
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.
In case of adding the exceptions into some header which is already included in SWIG, like the include/libdnf/conf/config_parser.hpp
, make sure to ignore these exceptions in related *.i
file, otherwise it won't compile, e.g. in conf.i
the following should do the trick:
%ignore libdnf::InaccessibleConfigError;
%ignore libdnf::InvalidConfigError;
b9f6efa
to
c1a531f
Compare
Resolves rpm-software-management#305 Signed-off-by: Evan Goode <mail@evangoo.de>
c1a531f
to
6ca197c
Compare
I moved the error declarations to |
Thank you! |
Ignore a missing or otherwise inaccessible
/etc/dnf/dnf.conf
instead of throwing an error.If the user specifies the path to the config file on the command line, like
dnf --config=/path/to/dnf.conf
, then an error will still be thrown and displayed.Similarly, if the config file is accessible but malformed/invalid, an error will still be thrown.
Resolves #305