Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ServerQuery Reply tests and improve exception message #205

Merged

Conversation

Sebbo94BY
Copy link
Collaborator

Improves the ServerQueryException message to be better able to identify the actual root cause.

Before:

PlanetTeamSpeak\TeamSpeak3Framework\Exception\ServerQueryException^ {#3929 // app/Http/Controllers/TeamSpeak.php:65
  #message: "invalid parameter"
  #code: 1538
  #file: "./vendor/planetteamspeak/ts3-php-framework/src/Adapter/ServerQuery/Reply.php"
  #line: 206
  #raw_code: 1538
  #raw_mesg: "invalid parameter"
  #return_code: null
  trace: {
    ./vendor/planetteamspeak/ts3-php-framework/src/Adapter/ServerQuery/Reply.php:206 { …}
    ./vendor/planetteamspeak/ts3-php-framework/src/Node/Server.php:633 { …}
    ./app/Http/Controllers/TeamSpeak.php:63 {
      App\Http\Controllers\TeamSpeak->get_current_client_list(): array^
      › try {
      ›     $client_list = $this->virtualserver->clientList(["client_type" => 0]);
      › } catch (ServerQueryException $ex) {
      arguments: {
        $filter: array:1 [ …1]
      }
    }
    [...]

After:

PlanetTeamSpeak\TeamSpeak3Framework\Exception\ServerQueryException^ {#3929 // app/Http/Controllers/TeamSpeak.php:65
  #message: "invalid parameter. ident 'clid' does not exist in node '{"put_muted":0,"client_output_muted":0,"client_input_hardware":1,"client_output_hardware":1,"client_talk_power":70,"client_is_talker":0,"client_is_priority_speaker":0,"client_is_recording":0,"client_is_channel_commander":0,"client_unique_identifier":"zBbdjIImKqM\/v18taBCdXhmoN4A=","client_servergroups":"137,146,147,261","client_channel_group_id":13,"client_channel_group_inherited_channel_id":108,"client_version":"3.5.6 [Build: 1606312422]","client_platform":"Linux","client_idle_time":117403360,"client_created":1684050729,"client_icon_id":0,"client_country":"DE",_icon_id":0,"client_country":"DE","connection_client_ip":"fe80::9400:ff:fe2b::1","client_badges":null}'"
  #code: 1538
  #file: "./vendor/planetteamspeak/ts3-php-framework/src/Adapter/ServerQuery/Reply.php"
  #line: 206
  #raw_code: 1538
  #raw_mesg: "invalid parameter. ident 'clid' does not exist in node '{"put_muted":0,"client_output_muted":0,"client_input_hardware":1,"client_output_hardware":1,"client_talk_power":70,"client_is_talker":0,"client_is_priority_speaker":0,"client_is_recording":0,"client_is_channel_commander":0,"client_unique_identifier":"zBbdjIImKqM\/v18taBCdXhmoN4A=","client_servergroups":"137,146,147,261","client_channel_group_id":13,"client_channel_group_inherited_channel_id":108,"client_version":"3.5.6 [Build: 1606312422]","client_platform":"Linux","client_idle_time":117403360,"client_created":1684050729,"client_lastconnected":1691241638,"client_icon_id":0,"client_country":"DE","connection_client_ip":"fe80::9400:ff:fe2b::1","client_badges":null}'"
  #return_code: null
  trace: {
    ./vendor/planetteamspeak/ts3-php-framework/src/Adapter/ServerQuery/Reply.php:206 { …}
    ./vendor/planetteamspeak/ts3-php-framework/src/Node/Server.php:633 { …}
    ./app/Http/Controllers/TeamSpeak.php:63 {
      App\Http\Controllers\TeamSpeak->get_current_client_list(): array^
      › try {
      ›     $client_list = $this->virtualserver->clientList(["client_type" => 0]);
      › } catch (ServerQueryException $ex) {
      arguments: {
        $filter: array:1 [ …1]
      }
    }
    [...]

Adds some further PHPUnit tests.

Sebi94nbg added 5 commits August 7, 2023 00:48
Adds the $node and $ident to the exception message to be better able to identify and fix the issue in the future.
@Sebbo94BY Sebbo94BY merged commit 64aa90a into planetteamspeak:dev Aug 6, 2023
4 checks passed
@Sebbo94BY Sebbo94BY deleted the Add-ServerQuery-Reply-tests branch August 6, 2023 23:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant