Skip to content

Conversation

@mrn3
Copy link

@mrn3 mrn3 commented May 2, 2018

If failed to put message on the bus, we need to throw an exception instead of just exiting. This is leading to problems where the errors are swallowed and we aren't seeing why events aren't getting onto bus. Eventually, we need to add retries for this too.

If failed to put message on the bus, we need to throw an exception instead of just exiting.  This is leading to problems where the errors are swallowed and we aren't seeing why events aren't getting onto bus.  Eventually, we need to add retries for this too.
* @todo we need to kill this process osmehow
*/
exit();
throw new \Exception("Could not put message on bus - result is: " . $result);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$result is an array, an the way this is written, it would throw an Array to string conversion error. So either $result would have to be flattened, or use the element of result that you want to see in Exception.

Copy link
Contributor

@Handyman Handyman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See in-line comments.

@mrn3
Copy link
Author

mrn3 commented May 2, 2018

Yeah, I thought that might be a problem - I assumed it would just flatten it for me when printing. Do you know how to easily flatten it? I see some functions by searching, but not sure if there is any easy way. It would just be nice to get the whole payload so we can see what we need. Another option I guess is we could pass in just the array, right?

function array_flatten($array,$return) {
for($x = 0; $x <= count($array); $x++) {
if(is_array($array[$x])) {
$return = array_flatten($array[$x], $return);
}
else {
if(isset($array[$x])) {
$return[] = $array[$x];
}
}
}
return $return;
}

$res = array_flatten($myarray, array());

@shiquemano
Copy link
Contributor

This change appears to have already been applied to the repo

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.

3 participants