raise exceptions instead of logging them and then failing relatively silently

This commit is contained in:
Maarten de Waard 2022-09-28 14:53:40 +02:00
parent 82478e5006
commit 5e5b8ce200
No known key found for this signature in database
GPG key ID: 1D3E893A657CC8DA

View file

@ -143,7 +143,7 @@ def store_kubernetes_secret(secret_dict, namespace, update=False):
) )
except FailToCreateError as ex: except FailToCreateError as ex:
current_app.logger.info(f"Secret not created because of exception {ex}") current_app.logger.info(f"Secret not created because of exception {ex}")
return raise ex
current_app.logger.info(f"Secret {verb} with api response: {api_response}") current_app.logger.info(f"Secret {verb} with api response: {api_response}")
@ -172,7 +172,7 @@ def store_kustomization(kustomization_template_filepath, app_slug):
except FailToCreateError as ex: except FailToCreateError as ex:
current_app.logger.info( current_app.logger.info(
f"Could not create {app_slug} Kustomization because of exception {ex}") f"Could not create {app_slug} Kustomization because of exception {ex}")
return False raise ex
current_app.logger.debug(f"Kustomization created with api response: {api_response}") current_app.logger.debug(f"Kustomization created with api response: {api_response}")
return True return True
@ -202,7 +202,7 @@ def delete_kustomization(kustomization_name):
except ApiException as ex: except ApiException as ex:
current_app.logger.info( current_app.logger.info(
f"Could not delete {kustomization_name} Kustomization because of exception {ex}") f"Could not delete {kustomization_name} Kustomization because of exception {ex}")
return False raise ex
current_app.logger.debug(f"Kustomization deleted with api response: {api_response}") current_app.logger.debug(f"Kustomization deleted with api response: {api_response}")
return api_response return api_response