Skip to content

Incorrect error handling when passed API key is wrong #16

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

Closed
DarkSnowCat opened this issue Nov 28, 2024 · 1 comment
Closed

Incorrect error handling when passed API key is wrong #16

DarkSnowCat opened this issue Nov 28, 2024 · 1 comment
Assignees

Comments

@DarkSnowCat
Copy link

Hi guys,

looks like the following code with using a wrong key:

$client = new Client('nope');
$voiceResource = new VoiceResource($client);

 // Setting up and testing params
$voiceParams = new VoiceParams($message, implode(',', $recipients));
$voiceParams->setRingtime(60);
$voiceResource->validate($voiceParams);

$voiceResponse = $voiceResource->call($voiceParams);

results in:

[2024-11-28 09:25:49] local.ERROR: Seven\Api\Resource\Voice\Voice::__construct(): Argument #1 ($data) must be of type object, int given, called in .../seven.io/api/src/Resource/Voice/VoiceResource.php on line 31

Shouldn't there be some kind of error handling?

Greets Michael

@DarkSnowCat
Copy link
Author

DarkSnowCat commented Nov 28, 2024

Hi again,

looke like in Client.php, line 117 if ($isSuccess) return $res; should be if ($isSuccess && is_object($res)) return $res;. Then it's working so far, not best solution.

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

No branches or pull requests

2 participants