INNER CODE UNIT · Python

__exit__

terraform-aws-modules/terraform-aws-lambda · package.py:354

    def __exit__(self, exc_type, exc_val, exc_tb):
        if exc_type is not None:
            # If the failure is a CalledProcessError that captured stderr,
            # surface that stderr in the log so the operator can see what
            # the underlying subprocess (typically pip) actually said.
            # Without this, every pip-install failure inside the zip
            # context surfaces only the generic line below, requiring the
            # operator to fork + instrument package.py to debug.
            if exc_type is subprocess.CalledProcessError and getattr(
                exc_val, "stderr", None
            ):
                stderr_text = (
                    exc_val.stderr.decode("utf-8", errors="replace")
                    if isinstance(exc_val.stderr, (bytes, bytearray))
                    else str(exc_val.stderr)
                )
                self._log.error(
                    "Subprocess failed during zip archive creation: %s\n"

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…