-
Notifications
You must be signed in to change notification settings - Fork 19
Open
Description
Client version
v3.0.0
Expected behaviour
When execute is called, it should always return an array of responses (a single output type).
$batch = $api->start_batch();
$batch->send();
$responses = $batch->execute();
if (is_array($responses)) {
echo "succeeded";
} else {
echo "failed";
}
should output succeeded in all cases
Actual behaviour
outputs failed if the batch was too large, or authentication failed, or any failure that's not specific to one of the emails in the batch.
The reason for requesting a change is that the current behavior requires boilerplate whenever calling execute():
if (!is_array($response)) {
//do we actually want to behave differently for this case? If so, should it be an exception?
} else {
//we can iterate over the responses to see what succeded, and what failed
}
Simplest "fix" would be to change this line: https://github.com/sendwithus/sendwithus_php/blob/master/lib/API.php#L782 to return the single error as an array. That way, a consumer can always depend on getting back an array.
Metadata
Metadata
Assignees
Labels
No labels