[katello-devel] Better exception handling in the CLI
Lukas Zapletal
lzap at redhat.com
Thu Jul 21 14:21:39 UTC 2011
Hello,
while working on the katello-cli RPM package I slightly improved logging.
Introduced KatelloError exception class and general handler in
cli/base.py. If you need to report error use this one, the first
constructor parameter is user-friendly message, 2nd is wrapped exception
(if any).
Do not consume this exception, let the main method to catch it. It will
print the user-friendly message to the stderr and also print the message
and the inner exception to the log file (including the backtrace).
So instead of consuming exceptions we should wrap it in the KatelloError
together with some nice message for the user and let it go up the stack
to the top level main method.
The log file will be in /var/log/katello/client.log for the root user
and ~/.katello/client.log for non-root users. This is borrowed from
pulp-client :-)
Btw what you like more:
1) katello-cli
2) katello-client
http://micropoll.com/t/KEvdsZB4fg
--
Later,
Lukas Zapletal | E32E400A
RHN Satellite Engineering
Red Hat Czech s.r.o. Brno
More information about the katello-devel
mailing list