* @copyright Since 2007 PrestaShop SA and Contributors * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 */ declare(strict_types=1); namespace PrestaShop\Module\Mbo\Helpers; use Exception; use PrestaShop\Module\Mbo\Exception\DownloadModuleException; use PrestaShop\PrestaShop\Core\Module\SourceHandler\SourceHandlerNotFoundException; class ModuleErrorHelper { /** * @param Exception $error * @param array|null $data * * @return Exception */ public static function reportAndConvertError(Exception $error, ?array $data = null): Exception { ErrorHelper::reportError($error, $data); if ($error instanceof SourceHandlerNotFoundException) { $error = new DownloadModuleException($data, $error); } return $error; } }