Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@ public function process(Server $server, string $ip, int $port): ?array
'max_players' => $info['sv_maxclients'],
'players' => array_map(fn ($player) => ['id' => (string) $player['id'], 'name' => (string) $player['name']], $players),
];
} catch (Exception $exception) {
report($exception);
} catch (Exception) {
// Not reported: a failed query almost always just means the server is offline,
// starting or otherwise unreachable, not an application error.
}

return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,9 @@ public function process(Server $server, string $ip, int $port): ?array
'max_players' => $info['MaxPlayers'],
'players' => null, // Bedrock has no player list
];
} catch (Exception $exception) {
report($exception);
} catch (Exception) {
// Not reported: a failed query almost always just means the server is offline,
// starting or otherwise unreachable, not an application error.
}

return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,10 @@ protected function tryQuery(string $ip, int $port): false|array
'max_players' => $info['MaxPlayers'],
'players' => array_map(fn ($player) => ['id' => (string) $player, 'name' => (string) $player], $players),
];
} catch (Exception $exception) {
report($exception);
} catch (Exception) {
// Not reported: a failed query almost always just means the server is offline,
// starting or otherwise unreachable, not an application error. It falls back to
// tryPing() below, and the UI already reflects an unreachable server on its own.
}

return false;
Expand All @@ -84,8 +86,8 @@ protected function tryPing(string $ip, int $port): false|array
'max_players' => $data['players']['max'],
'players' => $data['players']['sample'] ?? [],
];
} catch (Exception $exception) {
report($exception);
} catch (Exception) {
// Not reported, see tryQuery() above - same reasoning applies to the ping fallback.
} finally {
if (isset($ping)) {
$ping->Close();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ public function process(Server $server, string $ip, int $port): ?array
'players' => array_map(fn ($player) => ['id' => (string) ($player['playerId'] ?? $player['userId']), 'name' => (string) $player['name']], $players),
];

} catch (Exception $exception) {
report($exception);

} catch (Exception) {
// Not reported: a failed query almost always just means the server is offline,
// starting or otherwise unreachable, not an application error.
return null;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,9 @@ protected function run(string $ip, int $port, int $engine): ?array
'max_players' => $info['MaxPlayers'],
'players' => array_map(fn ($player) => ['id' => (string) $player['Id'], 'name' => (string) $player['Name']], $players),
];
} catch (Exception $exception) {
report($exception);
} catch (Exception) {
// Not reported: a failed query almost always just means the server is offline,
// starting or otherwise unreachable, not an application error.
} finally {
$query->Disconnect();
}
Expand Down
Loading