| Conditions | 5 |
| Paths | 11 |
| Total Lines | 22 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 5 | ||
| Bugs | 1 | Features | 0 |
| 1 | <?php |
||
| 26 | public function reportSentryNotification(Throwable $e): void |
||
| 27 | { |
||
| 28 | if (!$this->canReportSentry($e)) { |
||
| 29 | return; |
||
| 30 | } |
||
| 31 | |||
| 32 | if (!$this->messengerClient) { |
||
| 33 | $this->messengerClient = app(MessengerClientFactory::class)->create(); |
||
| 34 | } |
||
| 35 | |||
| 36 | try { |
||
| 37 | $eventId = $this->sentryService->captureException($e); |
||
| 38 | |||
| 39 | if (empty($eventId)) { |
||
| 40 | throw new SentryNotifierException('Empty Event ID response'); |
||
| 41 | } |
||
| 42 | |||
| 43 | $issueUrl = $this->sentryService->getIssueUrl($eventId); |
||
| 44 | $this->messengerClient->sendMessage($e, $issueUrl); |
||
| 45 | } catch (Throwable $_e) { |
||
| 46 | Log::error(get_class($e) . 'Exception: ' . $e->getMessage() . PHP_EOL . $e->getTraceAsString()); |
||
| 47 | throw new SentryNotifierException('Sentry Notifier error: ' . $_e->getMessage() |
||
| 48 | ); |
||
| 57 |