Skip to content

Commit

Permalink
[media] fixes issue when media module try to instantiate a non existi…
Browse files Browse the repository at this point in the history
…ng instrument. (#8903)

A try catch block was added to prevent the module to break if for any reason one of the instruments could not be instantiated. Resolves #8902
  • Loading branch information
racostas authored Dec 5, 2023
1 parent 47637c8 commit d7a599b
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions modules/media/php/mediafileprovisioner.class.inc
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,19 @@ class MediaFileProvisioner extends \LORIS\Data\Provisioners\DBRowProvisioner

// make sure not to call the factory when $testname is null or ''
if (!empty($testname) && !isset($this->_instrumentnames[$testname])) {
$this->_instrumentnames[$testname] = \NDB_BVL_Instrument::factory(
$this->lorisinstance,
$testname,
)->getFullname();
try {
$this->_instrumentnames[$testname] = \NDB_BVL_Instrument::factory(
$this->lorisinstance,
$testname,
)->getFullname();
} catch (\Exception $e) {
error_log(
"There was a problem instantiating the instrument ".
"'$testname'. Make sure the instrument is valid and ".
"functional in order for it to be displayed in the media ".
"module."
);
}
}
$row['fullName'] = $this->_instrumentnames[$testname] ?? null;

Expand Down

0 comments on commit d7a599b

Please # to comment.