Skip to content

Commit

Permalink
Handle container errors correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
saville committed Nov 20, 2024
1 parent c1aa57f commit f998d98
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions buildrunner/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import sys
import tarfile
import tempfile
import traceback
import types
from typing import List, Optional

Expand All @@ -35,6 +36,7 @@
from buildrunner.errors import (
BuildRunnerConfigurationError,
BuildRunnerProcessingError,
BuildRunnerError,
)
from buildrunner.steprunner import BuildStepRunner
from buildrunner.docker.multiplatform_image_builder import MultiplatformImageBuilder
Expand Down Expand Up @@ -470,13 +472,6 @@ def run(self): # pylint: disable=too-many-statements,too-many-branches,too-many
)
else:
self.log.write("\nPush not requested\n")

except BuildRunnerConfigurationError as brce:
exit_explanation = str(brce)
self.exit_code = os.EX_CONFIG
except BuildRunnerProcessingError as brpe:
exit_explanation = str(brpe)
self.exit_code = 1
except requests.exceptions.ConnectionError as rce:
print(str(rce))
exit_explanation = (
Expand All @@ -486,6 +481,12 @@ def run(self): # pylint: disable=too-many-statements,too-many-branches,too-many
"remote PyPi server information is set correctly."
)
self.exit_code = 1
except BuildRunnerError as exc:
exit_explanation = str(exc)
self.exit_code = 1
except Exception as exc:
exit_explanation = f"Encountered unhandled exception ({type(exc).__name__}) {traceback.format_exc()}"
self.exit_code = 1

finally:
self._write_artifact_manifest()
Expand Down

0 comments on commit f998d98

Please sign in to comment.