Skip to content

Commit

Permalink
Merge pull request #77 from eclipxe13/fix-catch-exception
Browse files Browse the repository at this point in the history
Fix catching wrong exception (Version 3.2.5)
  • Loading branch information
eclipxe13 authored Jul 3, 2023
2 parents e052209 + 4419ea5 commit b739661
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 deletions.
6 changes: 3 additions & 3 deletions .phive/phars.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<phive xmlns="https://phar.io/phive">
<phar name="php-cs-fixer" version="^3.18.0" installed="3.18.0" location="./tools/php-cs-fixer" copy="false"/>
<phar name="php-cs-fixer" version="^3.20.0" installed="3.20.0" location="./tools/php-cs-fixer" copy="false"/>
<phar name="phpcs" version="^3.7.2" installed="3.7.2" location="./tools/phpcs" copy="false"/>
<phar name="phpcbf" version="^3.7.2" installed="3.7.2" location="./tools/phpcbf" copy="false"/>
<phar name="phpstan" version="^1.10.21" installed="1.10.21" location="./tools/phpstan" copy="false"/>
<phar name="composer-normalize" version="^2.31.0" installed="2.31.0" location="./tools/composer-normalize" copy="false"/>
<phar name="phpstan" version="^1.10.22" installed="1.10.22" location="./tools/phpstan" copy="false"/>
<phar name="composer-normalize" version="^2.32.0" installed="2.32.0" location="./tools/composer-normalize" copy="false"/>
</phive>
7 changes: 7 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ Usamos [Versionado Semántico 2.0.0](SEMVER.md) por lo que puedes usar esta libr

## Cambios aún no liberados en una versión

## Versión 3.2.5 2023-07-03

Algunos métodos intentaban atrapar una excepción `RuntimeException` proveniente de `Crawler`, sin embargo,
la excepción no era correcta, se atrapa ahora `Throwable`. Gracias a PHPStan por detectar el problema.

Se actualizan las dependencias de desarrollo.

## Versión 3.2.4 2023-06-22

Se corrige el mensaje relacionado con el envío de datos incorrectos al iniciar sesión usando CIEC.
Expand Down
4 changes: 2 additions & 2 deletions src/Internal/HtmlForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
namespace PhpCfdi\CfdiSatScraper\Internal;

use DOMElement;
use RuntimeException;
use Symfony\Component\DomCrawler\Crawler;
use Throwable;

/**
* Utility class to extract data from an HTML form.
Expand Down Expand Up @@ -166,7 +166,7 @@ private function filterCrawlerElements(string $filter)
{
try {
$elements = $this->crawler->filter($filter);
} catch (RuntimeException $exception) {
} catch (Throwable $exception) {
$elements = [];
}
/** @var Crawler|DOMElement[] $elements */
Expand Down
3 changes: 2 additions & 1 deletion src/Internal/MetadataExtractor.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use PhpCfdi\CfdiSatScraper\URLS;
use RuntimeException;
use Symfony\Component\DomCrawler\Crawler;
use Throwable;

/**
* Parses a web page to obtain all the Metadata records on it.
Expand Down Expand Up @@ -182,7 +183,7 @@ private function obtainOnClickFromElement(Crawler $crawler, string $elementFilte
{
try {
$filteredElements = $crawler->filter($elementFilter);
} catch (RuntimeException $exception) {
} catch (Throwable $exception) {
return '';
}

Expand Down

0 comments on commit b739661

Please sign in to comment.