Skip to content

Commit

Permalink
Remove unneeded Try and Catch
Browse files Browse the repository at this point in the history
  • Loading branch information
dbarrous committed Aug 14, 2023
1 parent 167204b commit d35861c
Showing 1 changed file with 18 additions and 33 deletions.
51 changes: 18 additions & 33 deletions lambda_function/src/file_processor/file_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,41 +240,26 @@ def _process_file(self) -> None:
filename=new_file_path,
file_key=new_file_key,
)
try:
if self.slack_client:
# Send Slack Notification
send_pipeline_notification(
slack_client=self.slack_client,
slack_channel=self.slack_channel,
path=new_file_path,
alert_type="processed",
)
except Exception as e:
log.error(
{
"status": "ERROR",
"message": f"Error when logging to Slack: {e}",
}

if self.slack_client:
# Send Slack Notification
send_pipeline_notification(
slack_client=self.slack_client,
slack_channel=self.slack_channel,
path=new_file_path,
alert_type="processed",
)

try:
if self.timestream_client:
# Log to timeseries database
log_to_timestream(
timestream_client=self.timestream_client,
action_type="PUT",
file_key=self.file_key,
new_file_key=new_file_key,
source_bucket=destination_bucket,
destination_bucket=destination_bucket,
environment=self.environment,
)
except Exception as e:
log.error(
{
"status": "ERROR",
"message": f"Error when logging to Timestream: {e}",
}
if self.timestream_client:
# Log to timeseries database
log_to_timestream(
timestream_client=self.timestream_client,
action_type="PUT",
file_key=self.file_key,
new_file_key=new_file_key,
source_bucket=destination_bucket,
destination_bucket=destination_bucket,
environment=self.environment,
)

except ValueError as e:
Expand Down

0 comments on commit d35861c

Please sign in to comment.