1818import sys
1919import tarfile
2020import tempfile
21+ import traceback
2122import types
2223from typing import List , Optional
2324
3536from buildrunner .errors import (
3637 BuildRunnerConfigurationError ,
3738 BuildRunnerProcessingError ,
39+ BuildRunnerError ,
3840)
3941from buildrunner .steprunner import BuildStepRunner
4042from buildrunner .docker .multiplatform_image_builder import MultiplatformImageBuilder
@@ -470,13 +472,6 @@ def run(self): # pylint: disable=too-many-statements,too-many-branches,too-many
470472 )
471473 else :
472474 self .log .write ("\n Push not requested\n " )
473-
474- except BuildRunnerConfigurationError as brce :
475- exit_explanation = str (brce )
476- self .exit_code = os .EX_CONFIG
477- except BuildRunnerProcessingError as brpe :
478- exit_explanation = str (brpe )
479- self .exit_code = 1
480475 except requests .exceptions .ConnectionError as rce :
481476 print (str (rce ))
482477 exit_explanation = (
@@ -486,6 +481,14 @@ def run(self): # pylint: disable=too-many-statements,too-many-branches,too-many
486481 "remote PyPi server information is set correctly."
487482 )
488483 self .exit_code = 1
484+ except BuildRunnerError as exc :
485+ exit_explanation = str (exc )
486+ self .exit_code = (
487+ os .EX_CONFIG if isinstance (exc , BuildRunnerConfigurationError ) else 1
488+ )
489+ except Exception as exc :
490+ exit_explanation = f"Encountered unhandled exception ({ type (exc ).__name__ } ) { traceback .format_exc ()} "
491+ self .exit_code = 1
489492
490493 finally :
491494 self ._write_artifact_manifest ()
0 commit comments