diff --git a/swan-cern/files/swan_computing_config.py b/swan-cern/files/swan_computing_config.py index f8afa9ec..34216cfc 100644 --- a/swan-cern/files/swan_computing_config.py +++ b/swan-cern/files/swan_computing_config.py @@ -120,7 +120,7 @@ async def _init_hadoop_secret(self): else: await self.spawner.api.create_namespaced_secret(swan_container_namespace, secret_data) except ApiException as e: - raise Exception(f'Could not create required hadoop secret: {e}\n') + raise RuntimeError('Could not create required hadoop secret') from e return hadoop_secret_name @@ -334,7 +334,7 @@ async def _open_ports(self, num_ports): try: service = await self.spawner.api.create_namespaced_service(swan_container_namespace, service_template) except ApiException as e: - raise Exception(f'Could not create service that allocates random ports for computing integrations: {e}\n') + raise RuntimeError('Could not create service that allocates random ports for computing integrations') from e # Replace the service with allocated nodeports to map nodeport:targetport # and set these ports for the notebook container @@ -373,7 +373,7 @@ async def _open_ports(self, num_ports): ) ) except ApiException as e: - raise Exception(f'Could not create required user ports: {e}\n') + raise RuntimeError('Could not create required user ports') from e def computing_modify_pod_hook(spawner, pod):