symfony / monolog-bundle

Symfony Monolog Bundle

Home Page:symfony.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to catch SlackWebhookHandler exceptions?

toby-griffiths opened this issue · comments

We have the SlackWebhookHandler set up on our produciton environment, but we've just realised that if the cURL requests to the Slack webhook fail, the whole application chokes with an uncaught exception.

I've tried to work out how we can configure a custom handler to wrap the slack webhook one but I've spent over an hour on this and still can't work out how.

So I have a few questions in my attempt to address this…

  1. Is it possible to wrap a core handler with your own, custom one? If I define the wrapper as a service, it wants the decorated service, which I've had issues with it telling me it doesn't exist!? Or is there another way to define it in config?
  2. What are people's thoughts on whether the cURL call to slack should be wrapped in a try/catch to prevent this bringing everythig down (probably one for the Monolog project)?
  3. Could we enhance this bundle to allow people to define custom handlers that decorate others (like the fingers crossed one does) purely in config? How easy would that be? It took me ages trying to wrap my head around how all these handler services are configured, and I still haven't understood it fully.

I'd be happy to pair with someone on this to come up with a good solution, if anyone knowledgable is willing, and we can find time.

I've raised Seldaek/monolog#1836 to also discuss with the Monolog team.

Thank you for bringing up this topic, but this is not an issue of Monolog's Symfony integration. I don't think that we need to threads to discuss this problem, so I'm closing this issue as a duplicate of Seldaek/monolog#1836.