Change record status: 
Project: 
Introduced in branch: 
8.6.x
Introduced in version: 
8.6.0
Description: 

Methods in the Drupal extension system now throw \Drupal\Core\Extension\Exception\UnknownExtensionException and \Drupal\Core\Extension\Exception\UninstalledExtensionException when operations are carried out on non-existent or uninstalled extensions (modules, themes, profiles or theme engines). In the past these same methods were throwing \InvalidArgumentException.

These methods are:
\Drupal\Core\Extension\ExtensionList::getName() now throws UnknownExtensionException
\Drupal\Core\Extension\ExtensionList::get() now throws UnknownExtensionException
\Drupal\Core\Extension\ExtensionList::getExtensionInfo() now throws UnknownExtensionException
\Drupal\Core\Extension\ModuleHandlerInterface::getModule() now throws UnknownExtensionException
\Drupal\Core\Extension\ThemeHandlerInterface::uninstall() now throws UninstalledExtensionException
\Drupal\Core\Extension\ThemeHandlerInterface::getTheme() now throws UnknownExtensionException
\Drupal\Core\Extension\ThemeInstallerInterface::install() now throws UnknownExtensionException
\Drupal\Core\Extension\ThemeInstallerInterface::uninstall() now throws UninstalledExtensionException

Since the two new exceptions extend \InvalidArgumentException, existing code which catches \InvalidArgumentException in a try block will not break, however, it is recommended to use the new exception classes.

Before

    if (isset($name)) {
      try {
        return $module_list->getExtensionInfo($name);
      }
      catch (\InvalidArgumentException $e) {
        return [];
      }
    }

After

    if (isset($name)) {
      try {
        return $module_list->getExtensionInfo($name);
      }
      catch (UnknownExtensionException $e) {
        return [];
      }
    }
Impacts: 
Module developers