On Mon, 2019-03-11 at 17:55 +0000, Daniel P. Berrangé wrote:
On Mon, Mar 11, 2019 at 06:48:11PM +0100, Andrea Bolognani wrote:
> This results in
>
> $ ./lcitool dockerfile dockerfile -x foo libvirt-debian-9 libvirt
> FROM debian:9
> ./lcitool: Unsupported architecture ppc64el
>
> being printed on error, instead of the much nastier
>
> $ ./lcitool dockerfile dockerfile -x foo libvirt-debian-9 libvirt
> FROM debian:9
> Traceback (most recent call last):
> File "./lcitool", line 704, in <module>
> Application().run()
> File "./lcitool", line 699, in run
> args.func(args)
> File "./lcitool", line 643, in _action_dockerfile
> deb_arch = Util.native_arch_to_deb_arch(args.cross_arch)
> File "./lcitool", line 126, in native_arch_to_deb_arch
> raise Exception("Unsupported architecture {}".format(native_arch))
> Exception: Unsupported architecture foo
I'm curious why the "Error" class exists at all ? It doesn't seem
to add anything that the normal "Exception" class can't do, and
leads to bugs like the one here.
I seem to understand you're not supposed to use Exception directly,
but rather define your own exception types:
https://docs.python.org/3/tutorial/errors.html#user-defined-exceptions
I remember reading more about this, but I can't find the source
right now.
--
Andrea Bolognani / Red Hat / Virtualization