diff --git a/boefjes/images/oci_adapter.py b/boefjes/images/oci_adapter.py index 32a788a4cf8..0027e11e4be 100755 --- a/boefjes/images/oci_adapter.py +++ b/boefjes/images/oci_adapter.py @@ -9,7 +9,11 @@ def main(): input_url = sys.argv[-1] - boefje_input = httpx.get(input_url).json() + try: + boefje_input = httpx.get(input_url).json() + except httpx.HTTPError as e: + # sys.exit will print the message on stderr and return with exit code 1 + sys.exit(f"Failed to get input from boefje API: {e}") try: os.environ.update(boefje_input["boefje_meta"]["environment"]) @@ -32,7 +36,10 @@ def main(): ], } - httpx.post(boefje_input["output_url"], json=out) + try: + httpx.post(boefje_input["output_url"], json=out) + except httpx.HTTPError as e: + sys.exit(f"Failed to post output to boefje API: {e}") if __name__ == "__main__":