use_exception(True) by default in lmishell

Stephen Gallagher sgallagh at redhat.com
Mon Jul 1 14:25:29 UTC 2013


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 07/01/2013 03:31 AM, Radek Novacek wrote:
> On Mon 01 of Jul 2013 9:17:18 Jan Synacek wrote:
>> Hello,
>> 
>> currently, exceptions in shell are silently ignored when risen,
>> unless 'use_exception(True)' is explicitly called. I strongly
>> suggest we change the default behavior to use the exceptions by
>> default and, if needed, turn them off by 'use_exception(False)'.
>> This will save a lot of gray hair in the future...
> 
> I think that exceptions should be hidden by default, but there
> *must* be some error written to the shell when something goes
> wrong.
> 
> Exceptions are very useful for us, developers, but can be confusing
> for end- users - it could be hard to determine, if the exception is
> bug in shell/providers or just wrong usage (like wrong
> username/password).
> 
> I suggest following behavior for lmishell:
> 
> * Don't raise exceptions in interactive mode by default (but it
> could be changed by use_exceptions(True) or some command line
> option * Print the error message when exceptions are turned off *
> Raise exception in lmishell scripts
> 
> Is this suggestion agreeable?
> 

I've been suggesting that we should have all expected exceptions in
the scriptons/lmishell inherit from a common LMIError class that will
have a .print_error() argument. This way, lmishell can just do a
generic trap for LMIError and report the error when use_exceptions(False).

Furthermore, this allows us to keep track of legitimate bugs, because
exceptions that make it all the way back up the stack without being
caught as an LMIError are by definition a programming error.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.13 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEARECAAYFAlHRkVkACgkQeiVVYja6o6Pm7wCbBpwqz6E7DGAfARYFgQbcA3As
NZUAnRJlBBL7M2YN2P5jAsKrAfeVLLJb
=bJV9
-----END PGP SIGNATURE-----


More information about the openlmi-devel mailing list