Throw an exception in ResourceLoaderImage::getPath when there is no
matching path instead of continue with null.
Change-Id: I677f4a53f4c90af27db0cc2fd8ef5f028fb49168
*
* @param ResourceLoaderContext $context Any context
* @return string
+ * @throws MWException If no matching path is found
*/
public function getPath( ResourceLoaderContext $context ) {
$desc = $this->descriptor;
if ( isset( $desc[$context->getDirection()] ) ) {
return $this->basePath . '/' . $desc[$context->getDirection()];
}
- return $this->basePath . '/' . $desc['default'];
+ if ( isset( $desc['default'] ) ) {
+ return $this->basePath . '/' . $desc['default'];
+ } else {
+ throw new MWException( 'No matching path found' );
+ }
}
/**