* @param string $name The name of the library
*
* @return void
- * @throws Exception
+ * @throws InvalidParameterException
* @since 1.8.0
*/
function elgg_load_library($name) {
}
if (!isset($CONFIG->libraries[$name])) {
- throw new Exception("Failed to load the $name library");
+ $error = elgg_echo('InvalidParameterException:LibraryNotRegistered', array($name));
+ throw new InvalidParameterException($error);
}
if (!include_once($CONFIG->libraries[$name])) {
- throw new Exception("Failed to load the $name library");
+ $error = elgg_echo('InvalidParameterException:LibraryNotRegistered', array($name));
+ throw new InvalidParameterException($error);
}
}
'InvalidParameterException:DoesNotBelong' => "Does not belong to entity.",
'InvalidParameterException:DoesNotBelongOrRefer' => "Does not belong to entity or refer to entity.",
'InvalidParameterException:MissingParameter' => "Missing parameter, you need to provide a GUID.",
+ 'InvalidParameterException:LibraryNotRegistered' => '%s is not a registered library',
'APIException:ApiResultUnknown' => "API Result is of an unknown type, this should never happen.",
'ConfigurationException:NoSiteID' => "No site ID has been specified.",