Skip to content

Commit

Permalink
Finished updating cmi5_connectors try/catch
Browse files Browse the repository at this point in the history
  • Loading branch information
ADLMeganBohland committed Jul 25, 2024
1 parent ad73275 commit 96369b5
Show file tree
Hide file tree
Showing 9 changed files with 1,068 additions and 345 deletions.
6 changes: 3 additions & 3 deletions classes/local/au.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ class au {
public function __construct($statement) {

// What can go wrong here? It could be that a statement is null
// or that the statement is not an array.
if (is_null($statement) || !is_array($statement)) {
// or that the statement is not an array or not an object.
if (is_null($statement) || (!is_array($statement) && !is_object($statement) )) {

throw new nullException('Statement to build AU is null or not an array.', 0);
throw new nullException('Statement to build AU is null or not an array/object.', 0);
}
// If it is an array, create the object.
foreach ($statement as $key => $value) {
Expand Down
9 changes: 7 additions & 2 deletions classes/local/au_helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
use mod_cmi5launch\local\au;
use mod_cmi5launch\local\errorover;

global $CFG;
// Include the errorover (error override) funcs.
require_once ($CFG->dirroot . '/mod/cmi5launch/classes/local/errorover.php');

Expand Down Expand Up @@ -53,6 +54,8 @@ public function get_cmi5launch_retrieve_aus_from_db() {
public function cmi5launch_retrieve_aus($returnedinfo) {

$resultchunked = "";


// Use our own more specific error handler, to give better info tto user.
set_error_handler('mod_cmi5launch\local\array_chunk_warning', E_WARNING);

Expand Down Expand Up @@ -244,10 +247,12 @@ public function cmi5launch_retrieve_aus_from_db($auid) {
$auitem = $DB->get_record('cmi5launch_aus', array('id' => $auid));

$au = new au($auitem);

// Return our new list of AU.
return $au;
}

// Return our new list of AU.
return $au;

}

}
Loading

0 comments on commit 96369b5

Please sign in to comment.