Skip to content

Commit 7d4db4a

Browse files
committed
Better exception handling
1 parent e684d37 commit 7d4db4a

3 files changed

Lines changed: 201 additions & 7 deletions

File tree

‎.idea/php.xml‎

Lines changed: 192 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎docs‎

Submodule docs updated from ed6d8e2 to c9a7331

‎src/ScripturNum.php‎

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -944,7 +944,6 @@ protected static function bkIndexToSingleRef($book, $index, &$chapter, &$verse)
944944
* @param null $exceptions
945945
*
946946
* @return ScripturNumArray
947-
* @throws ScripturNumException
948947
*/
949948
public static function extractFromString(string $string, bool $excludeAllBookOnlyRefs = false, &$exceptions = null): ScripturNumArray
950949
{
@@ -1001,14 +1000,17 @@ public static function extractFromString(string $string, bool $excludeAllBookOnl
10011000
$lastBook = -1;
10021001
$lastEnd = -1;
10031002
foreach ($combinedMatches as $m) {
1004-
if (is_array($exceptions)) {
1003+
try {
10051004
$ints = static::stringToInts($m[0], $exceptions);
1006-
} else {
1007-
$e = []; // functionally suppressing exceptions
1008-
$ints = static::stringToInts($m[0], $e);
1005+
} catch (ScripturNumException $e) {
1006+
continue;
10091007
}
10101008
foreach($ints as $i) {
1011-
$sn = new static($i);
1009+
try {
1010+
$sn = new static($i);
1011+
} catch (ScripturNumException $e) {
1012+
continue;
1013+
}
10121014
if ($lastBook != $sn->book && $lastEnd > $m[1]) {
10131015
// See issue #14
10141016
continue;

0 commit comments

Comments
 (0)