Skip to content

Commit cd469e2

Browse files
author
Seiya Shimizu
authored
Merge pull request #2 from whill-labs/fix/redundant-throw-of-exception
throw class-specific exception instead of generic Exception
2 parents 0927dbd + c3ff571 commit cd469e2

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

Diff for: src/awsiotclient/jobs.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ def __init__(
103103
self.try_start_next_job()
104104

105105
except Exception as e:
106-
raise (e)
106+
raise ExceptionAwsIotJobs(e)
107107

108108
def try_start_next_job(self) -> None:
109109
logger.debug("Trying to start the next job...")
@@ -156,7 +156,7 @@ def on_next_job_execution_changed(self, event: iotjobs.NextJobExecutionChangedEv
156156
logger.debug("Received Next Job Execution Changed event: ", "None. Waiting for further jobs...")
157157

158158
except Exception as e:
159-
raise (e)
159+
raise ExceptionAwsIotJobs(e)
160160

161161
def on_publish_start_next_pending_job_execution(self, future: Future) -> None: # type: ignore
162162
try:
@@ -165,7 +165,7 @@ def on_publish_start_next_pending_job_execution(self, future: Future) -> None:
165165
logger.debug("Published request to start the next job.")
166166

167167
except Exception as e:
168-
raise (e)
168+
raise ExceptionAwsIotJobs(e)
169169

170170
def on_start_next_pending_job_execution_accepted(self, response):
171171
# type: (iotjobs.StartNextJobExecutionResponse) -> None
@@ -191,7 +191,7 @@ def on_start_next_pending_job_execution_accepted(self, response):
191191
self.done_working_on_job()
192192

193193
except Exception as e:
194-
raise (e)
194+
raise ExceptionAwsIotJobs(e)
195195

196196
def on_start_next_pending_job_execution_rejected(self, rejected: iotjobs.RejectedError) -> None:
197197
raise ExceptionAwsIotJobs(
@@ -236,14 +236,14 @@ def on_publish_update_job_execution(self, future: Future) -> None: # type: igno
236236
logger.debug("Published request to update job.")
237237

238238
except Exception as e:
239-
raise (e)
239+
raise ExceptionAwsIotJobs(e)
240240

241241
def on_update_job_execution_accepted(self, response: iotjobs.UpdateJobExecutionResponse) -> None:
242242
try:
243243
logger.debug("Request to update job was accepted.")
244244
self.done_working_on_job()
245245
except Exception as e:
246-
raise (e)
246+
raise ExceptionAwsIotJobs(e)
247247

248248
def on_update_job_execution_rejected(self, rejected: iotjobs.RejectedError) -> None:
249249
raise ExceptionAwsIotJobs(

0 commit comments

Comments
 (0)