atymic/twitter

RuntimeException [34] Sorry, that page does not exist.

federicodelpiano opened this issue · 1 comments

Describe the bug
I'm getting "RuntimeException. [34] Sorry, that page does not exist." when i try to get the User Timeline of a user that doesn't exist.

To Reproduce
Steps to reproduce the behavior:

  1. Call this method in the Controller
    $tweets = Twitter::getUserTimeline(['screen_name' => 'non-existing-username', 'count' => 20, 'format' => 'object']);
  2. See error

Expected behavior
I'm trying to bypass the exception with a try/catch statement, but i still get the error.

Error Messages / Stack Trace
RuntimeException
[34] Sorry, that page does not exist.

Thujohn\Twitter\Twitter::query:316
C:\Users\Fede\Desktop\blog\vendor\thujohn\twitter\src\Thujohn\Twitter\Twitter.php:316

Version
2.2

Hi @federicodelpiano

You should be able to catch it with a try catch, like so:

try {
	$tweets = Twitter::getUserTimeline(['screen_name' => 'non-existing-username', 'count' => 20, 'format' => 'object']);
} catch (\RuntimeException $e) {
	$tweets = null;
	// whatever
}