K
K
kapai692014-02-04 19:37:20
symfony
kapai69, 2014-02-04 19:37:20

Symfony 2 Crawler: how to catch an exception?

Good evening, do you have a code?

$page = new Crawler($content);
$currentPrice = $page->filter($parse->getParse())->text();
If parsing fails and empty is returned, then the method ->text()throws an exception, The current node list is empty.
How to catch him? Or how to properly handle this situation?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Shurik, 2014-02-06
@aioon

your method with Try Catch Throw SymfonyException

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question