Skip to content

Commit

Permalink
Merge pull request #26 from stopfstedt/rm_unnecessary_exception_rethr…
Browse files Browse the repository at this point in the history
…owing

rm unnecessary try/catch block around the Ilios client instantiation.
  • Loading branch information
jrjohnson authored Oct 14, 2024
2 parents 133cad9 + 31ae556 commit f5c78a2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
3 changes: 2 additions & 1 deletion classes/form/create_sync_job.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,9 @@ public function definition(): void {
$roleoptions[$role->id] = $role->localname;
}

$iliosclient = di::get(ilios::class);

try {
$iliosclient = di::get(ilios::class);
$iliosschools = $iliosclient->get_schools();
if (!empty($iliosschools)) {
$iliosschools = array_column($iliosschools, 'title', 'id');
Expand Down
7 changes: 1 addition & 6 deletions classes/task/sync_task.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,7 @@ public function execute(): void {
return;
}

try {
$iliosclient = di::get(ilios::class);
} catch (Exception $e) {
// Re-throw exception.
throw new Exception('ERROR: Failed to instantiate Ilios client.', $e);
}
$iliosclient = di::get(ilios::class);

// Run enabled each sync job.
foreach ($syncjobs as $syncjob) {
Expand Down

0 comments on commit f5c78a2

Please sign in to comment.