slack-client icon indicating copy to clipboard operation
slack-client copied to clipboard

catch and log payload handling errors

Open nopolabs opened this issue 8 years ago • 2 comments

It doesn't look like you are maintaining slack-client any longer, but my bot receives killer channel_archive messages from Slack, I haven't caught the message itself, but here is the result:

PHP Fatal error: Uncaught ErrorException: Illegal string offset 'id' in /home/kip/php-kip/vendor/coderstephen/slack-client/src/RealTimeClient.php:406

This PR attempts to ameliorate by catching and logging errors thrown while handling payloads.

nopolabs avatar May 24 '17 05:05 nopolabs

I'd avoid Throwable if possible, since the library is currently targeting PHP 5.5+. We could boost it to PHP 7+ only as a new version, but we can't because there's some known compatibility issues between the websocket library being used and PHP 7.

sagebind avatar May 24 '17 14:05 sagebind

I have changed the PR to use \Exception instead. I am using a fork of devristo/phpws with updated react/socket and react/socket-client dependencies https://github.com/nopolabs/phpws/commit/40c0be66747ff982f287bc9f35a34ca67d72eb19 and haven't had any troubles.

nopolabs avatar May 24 '17 14:05 nopolabs