error("[sentry] ERROR: Missing configuration for $key"); } if (is_array($config[$key])) { $output .= "-> $key: [" . implode(', ', $config[$key]) . "]\n"; } else { $output .= "-> $key: $config[$key]\n"; } } $this->info("[sentry] Client configuration:\n" . trim($output)); $this->info('[sentry] Generating test event'); $ex = $this->generateTestException('command name', array('foo' => 'bar')); $event_id = $client->captureException($ex); $this->info("[sentry] Sending test event with ID: $event_id"); $last_error = $client->getLastError(); if (!empty($last_error)) { $this->error("[sentry] There was an error sending the test event:\n $last_error"); } } catch (\Exception $e) { // Ignore any exceptions } error_reporting($old_error_reporting); } /** * Generate a test exception to send to Sentry. * * @param $command * @param $arg * * @return \Exception */ protected function generateTestException($command, $arg) { // Do something silly try { throw new \Exception('This is a test exception sent from the Raven CLI.'); } catch (\Exception $ex) { return $ex; } } }