title: Catching Exceptions from library using Laravel 5.2
body: <p>Pretty new to laravel, so I'm not exactly sure how it handles errors and how best to catch them.</p>
  
  <p>I'm using a 3rd party game server connection library that can query game servers in order to pull data such as players, current map etc..</p>
  
  <p>This library is called Steam Condenser : <a href="https://github.com/koraktor/steam-condenser" rel="nofollow">https://github.com/koraktor/steam-condenser</a></p>
  
  <p>I have imported this using composer in my project and all seems to be working fine, however I'm having trouble with catching exceptions that are thrown by the library.</p>
  
  <p>One example is where the game server you are querying is offline.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>public function show($server_name)
  {
      try{
          SteamSocket::setTimeout(3000);
          $server = server::associatedServer($server_name);
          $server_info = new SourceServer($server-&gt;server_ip);
  
          $server_info-&gt;rconAuth($server-&gt;server_rcon);
  
          $players = $server_info-&gt;getPlayers();
          $total_players = count($players);
  
          $more_info = $server_info-&gt;getServerInfo();
  
          $maps = $server_info-&gt;rconExec('maps *');
          preg_match_all("/(?&lt;=fs\)).*?(?=\.bsp)/", $maps, $map_list);    
      }catch(SocketException $e){
          dd("error");
      }
      return view('server', compact('server', 'server_info', 'total_players', 'players', 'more_info', 'map_list'));
  }
  </code></pre>
  
  <p>If the server is offline, it will throw a SocketException, which I try to catch, however this never seems to happen. I then get the error page with the trace.</p>
  
  <p>This causes a bit of a problem as I wish to simply tell the end user that the server is offline, however I cannot do this if I can't catch this error.</p>
  
  <p>Is there something wrong with my try/catch? Does laravel handle catching errors in this way? Is this an issue with the 3rd party library?</p>