Skip to content
Snippets Groups Projects
Commit ec481f73 authored by Thijs Kinkhorst's avatar Thijs Kinkhorst
Browse files

Throw an error when downloading remote module definition fails.

parent 914e101a
No related branches found
No related tags found
No related merge requests found
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
/** /**
* Represents a definitino of a module. * Represents a definition of a module.
* Is usually read and parsed from a JSON definition file. * Is usually read and parsed from a JSON definition file.
* *
* @Author Andreas Åkre Solberg, <andreas.solberg@uninett.no> * @Author Andreas Åkre Solberg, <andreas.solberg@uninett.no>
...@@ -43,6 +43,9 @@ class sspmod_core_ModuleDefinition { ...@@ -43,6 +43,9 @@ class sspmod_core_ModuleDefinition {
} elseif(preg_match('|^http(s)?://.*$|', $id)) { } elseif(preg_match('|^http(s)?://.*$|', $id)) {
$defraw = file_get_contents($id); $defraw = file_get_contents($id);
if ( $defraw === FALSE ) {
throw new Exception('Error while downloading module definition [' . $id . ']');
}
$def = json_decode($defraw, TRUE); $def = json_decode($defraw, TRUE);
} else { } else {
throw new Exception('Could not resolve [' . $id . '] as URL nor module identifier.'); throw new Exception('Could not resolve [' . $id . '] as URL nor module identifier.');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment