]> git.ipfire.org Git - thirdparty/mkosi.git/commit
Do not print hint about exception for RuntimeError 1463/head
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 19 Apr 2023 14:21:16 +0000 (16:21 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 19 Apr 2023 20:31:41 +0000 (22:31 +0200)
commitb89db00359ad28e90a1923f3b483b63e7f47829a
tree7f3df267e78fb69ee1c6692e4a21ed0efd13455a
parent807d632a3e1cc466481e40969a39eeff44dec00f
Do not print hint about exception for RuntimeError

If debug is already on, the hint is not useful. Also, if we already printed an
error, we don't need to tell the user that we internally used an exception,
this is not relevant to the user.

Also, change str(e) to e.__class__.__name__. 'str(e)' is the same as 'e' here,
and is not guaranteed to contain any message. E.g. for 'raise ValueError',
str(e) is just ''. Let's say "internal exception CLASS" instead.

I still don't think RuntimeError is a great choice. It'd be totally unsuitable
if mkosi was used as a library. We don't do this right now, so it's not so bad,
but we could still get confused by RuntimeError generated in some sloppy code
in one of the packages that we call. This is hopefully unlikely, but our own
custom exception would be clearer and free of this risk. Alas, RuntimeError was
added purposefully in e25d746f9d7668edc5134cde4ec381c8b2da0136, so I'm not
changing it.
mkosi/__main__.py