[elbe-devel] [PATCH 1/8] elbepack: cdroms.py: adding exception handling

Thomas Weißschuh t-8ch at linutronix.de
Tue Apr 2 08:34:28 CEST 2024


On Thu, Mar 28, 2024 at 02:41:02PM +0100, Eduard Krein wrote:
> adding exception handling to check if files can be copied
> onto build target.
> 
> Signed-off-by: Eduard Krein <eduard.krein at linutronix.de>
> ---
>  elbepack/cdroms.py | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/elbepack/cdroms.py b/elbepack/cdroms.py
> index 7e318188..0d8462fc 100644
> --- a/elbepack/cdroms.py
> +++ b/elbepack/cdroms.py
> @@ -139,6 +139,8 @@ def mk_binary_cdrom(rfs, arch, codename, init_codename, xml, target):
>                            'The generated CDROM will not contain initvm pkgs\n'
>                            'This happened because the initvm was probably\n'
>                            'generated with --skip-build-bin')
> +    except Exception as e:
> +        logging.error('Failure to copy files into target directory: %s', e)

We already catc hsubprocess.CalleProcessError just above.
Which other exception can happen here?

In exception handlers it is better to use logging.exception() as that
will capture the complete exception information.

>  
>          do(f'mkdir -p "{repo_path}"')
>  
> -- 
> 2.39.2
> 
> _______________________________________________
> elbe-devel mailing list
> elbe-devel at linutronix.de
> https://lists.linutronix.de/mailman/listinfo/elbe-devel


More information about the elbe-devel mailing list