exception catch fixes
This commit is contained in:
parent
058f103812
commit
95af2c5ec9
|
@ -43,6 +43,7 @@ abstract class Source {
|
|||
$this->parse();
|
||||
} catch (\Exception $e) {
|
||||
echo 'Caught exception: ', $e->getMessage(), "\n";
|
||||
echo $e->getTraceAsString();
|
||||
return;
|
||||
}
|
||||
$this->endSection();
|
||||
|
|
|
@ -23,7 +23,7 @@ class Anivisual extends Source {
|
|||
$text = $this->get_text('http://anivisual.net/stuff/1');
|
||||
try {
|
||||
$this->dom->loadStr($text, []);
|
||||
} catch (Exception $e) {
|
||||
} catch (\Exception $e) {
|
||||
echo $e->getMessage();
|
||||
echo $e->getTraceAsString();
|
||||
return "";
|
||||
|
|
|
@ -9,7 +9,7 @@ class Hyperbook extends Source {
|
|||
$text = $this->get_text('http://hyperbook.ru/lib.php?sort=time');
|
||||
try {
|
||||
$this->dom->loadStr($text, []);
|
||||
} catch (Exception $e) {
|
||||
} catch (\Exception $e) {
|
||||
echo $e->getMessage();
|
||||
echo $e->getTraceAsString();
|
||||
return "";
|
||||
|
@ -19,7 +19,7 @@ class Hyperbook extends Source {
|
|||
$games = [];
|
||||
try {
|
||||
$headings = $container->find("h3");
|
||||
} catch ( Exception $e ) {
|
||||
} catch (\Exception $e ) {
|
||||
echo $e->getMessage();
|
||||
echo $e->getTraceAsString();
|
||||
return "";
|
||||
|
|
|
@ -13,10 +13,10 @@ class Steam extends Source {
|
|||
'displayterm' => $tag,
|
||||
'category1' => 998, // only games
|
||||
]);
|
||||
$text = $this->get_text($url);
|
||||
try {
|
||||
$text = $this->get_text($url);
|
||||
$this->dom->loadStr($text, []);
|
||||
} catch (Exception $e) {
|
||||
} catch (\Exception $e) {
|
||||
echo $e->getMessage();
|
||||
echo $e->getTraceAsString();
|
||||
return "";
|
||||
|
@ -25,17 +25,24 @@ class Steam extends Source {
|
|||
$games = $this->dom->find('#search_result_container a.search_result_row');
|
||||
foreach ($games as $gameLink) {
|
||||
$url = $gameLink->getAttribute('href');
|
||||
$text = $this->get_text($url);
|
||||
try {
|
||||
$this->dom->loadStr($text, []);
|
||||
} catch (Exception $e) {
|
||||
continue;
|
||||
}
|
||||
unset($text);
|
||||
$game = new Game;
|
||||
$game->title = $this->dom->find('.apphub_AppName')->innerHtml;
|
||||
$game->description = $this->dom->find('.game_description_snippet')->innerHtml;
|
||||
$game->url = $url;
|
||||
try {
|
||||
$text = $this->get_text($url);
|
||||
$this->dom->loadStr($text, []);
|
||||
unset($text);
|
||||
$name = $this->dom->find('.apphub_AppName');
|
||||
$description = $this->dom->find('.game_description_snippet');
|
||||
try {
|
||||
$game->title = $name->innerHtml;
|
||||
$game->description = $description->innerHtml;
|
||||
} catch (\Exception $e) {
|
||||
echo 'No title or description found for '.$url.PHP_EOL;
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
echo $e->getMessage();
|
||||
echo $e->getTraceAsString();
|
||||
}
|
||||
$this->output .= $game->print();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ class Textadventures extends Source {
|
|||
$desc
|
||||
));
|
||||
}
|
||||
} catch (Exception $e) {} // probably a 18+ game, no info on game page
|
||||
} catch (\Exception $e) {} // probably a 18+ game, no info on game page
|
||||
|
||||
$this->output .= $game->print();
|
||||
}
|
||||
|
|
Reference in a new issue