本文整理汇总了PHP中Illuminate\Foundation\Exceptions\Handler::report方法的典型用法代码示例。如果您正苦于以下问题:PHP Handler::report方法的具体用法?PHP Handler::report怎么用?PHP Handler::report使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Foundation\Exceptions\Handler
的用法示例。
在下文中一共展示了Handler::report方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: report
/**
* Report or log an exception.
*
* This is a great spot to send exceptions to Sentry, Bugsnag, etc.
*
* @param \Exception $e
* @return void
*/
public function report(Exception $e)
{
if (app()->environment('production')) {
app(ErrorReporting::class)->send($e);
}
return parent::report($e);
}
示例2: report
/**
* Report or log an exception.
*
* This is a great spot to send exceptions to Sentry, Bugsnag, etc.
*
* @param \Exception $e
*
* @return void
*/
public function report(Exception $e)
{
if ($this->shouldReport($e) && app()->bound('bugsnag')) {
app('bugsnag')->notifyException($e, null, 'error');
}
return parent::report($e);
}
示例3: report
/**
* Report or log an exception.
*
* This is a great spot to send exceptions to Sentry, Bugsnag, etc.
*
* @param \Exception $e
* @return void
*/
public function report(Exception $e)
{
if (!config('app.debug') && $this->shouldReport($e)) {
if ($this->isHttpException($e)) {
$status_code = $e->getStatusCode();
} else {
$status_code = $e->getCode();
}
Cache::remember('suppress-error-notification:' . $status_code . ':' . $e->getFile() . ':' . $e->getLine(), Carbon::now()->addHours(config('sns-error-notification.cache-hours')), function () use($e, $status_code) {
// Build the "trace" variable
if (method_exists($e, 'getTrace')) {
$all_trace = $e->getTrace();
$trace_items = [];
foreach ($all_trace as $item) {
$trace_items[] = " " . json_encode($item);
}
if (count($trace_items)) {
$trace = implode("\n\n", $trace_items);
} else {
$trace = '(No trace data)';
}
} else {
$trace = '(exception does not have a trace method)';
}
$message = $e->getMessage();
if (!$message) {
$message = "Error in " . $e->getFile();
}
$sns = AWS::createClient('sns');
$result = $sns->publish(['Message' => "URL: " . Request::fullUrl() . "\n" . "Method: " . Request::method() . "\n" . "Message: " . $message . "\n" . "Error Code: " . $status_code . "\n" . "File: " . $e->getFile() . "\n" . "Line: " . $e->getLine() . "\n\n" . "User ID: " . (auth()->check() ? auth()->User()->id : 'Guest') . "\n\n" . "Session: " . json_encode(session()->all()) . "\n\n" . "Request: " . json_encode(request()->all()) . "\n\n" . "Trace: " . $trace, 'Subject' => config('sns-error-notification.notification-subject'), 'TopicArn' => config('sns-error-notification.sns-topic')]);
return true;
});
}
return parent::report($e);
}
示例4: report
/**
* Report or log an exception.
*
* This is a great spot to send exceptions to Sentry, Bugsnag, etc.
*
* @param \Exception $e
* @return void
*/
public function report(Exception $e)
{
if ($this->shouldReport($e)) {
Log::error($e);
}
parent::report($e);
}
示例5: report
/**
* Report or log an exception.
*
* This is a great spot to send exceptions to Sentry, Bugsnag, etc.
*
* @param \Exception $e
* @return void
*/
public function report(Exception $e)
{
if ($e instanceof QueryException) {
return "teste";
}
return parent::report($e);
}
示例6: report
/**
* Report or log an exception.
*
* This is a great spot to send exceptions to Sentry, Bugsnag, etc.
*
* @param \Exception $e
* @return void
*/
public function report(Exception $e)
{
if ($this->shouldReport($e) && app()->environment() == 'local') {
$this->mailer->getSwiftMailer()->send(SwiftMessage::newInstance(null)->addTo('log@localhost')->addFrom('noreply@localhost', 'Laravel Drydock')->setBody($this->render(null, $e)->getContent())->setContentType('text/html'));
}
parent::report($e);
}
示例7: report
/**
* Report or log an exception.
*
* This is a great spot to send exceptions to Sentry, Bugsnag, etc.
*
* @param \Exception $e
* @return void
*/
public function report(Exception $e)
{
/*if ($this->shouldReport($e)) {
app('sentry')->captureException($e);
}*/
parent::report($e);
}
示例8: report
/**
* Report or log an exception.
*
* This is a great spot to send exceptions to Sentry, Bugsnag, etc.
*
* @param \Exception $exception
*/
public function report(Exception $exception)
{
if ($this->shouldReport($exception)) {
app('sentry')->captureException($exception);
}
return parent::report($exception);
}
示例9: report
/**
* Report or log an exception.
*
* This is a great spot to send exceptions to Sentry, Bugsnag, etc.
*
* @param \Exception $e
* @return void
*/
public function report(Exception $e)
{
if ($e instanceof VerifyCsrfToken) {
Log::error('CSRF Error', ['exception' => $e, 'url' => URL::current()]);
}
return parent::report($e);
}
示例10: report
/**
* Report or log an exception.
*
* This is a great spot to send exceptions to Sentry, Bugsnag, etc.
*
* @param \Exception $e
* @return void
*/
public function report(Exception $e)
{
if (config('app.debug') && $e instanceof DevBaseException) {
//TODO not sure what to do with custom exception, temporarily using system error pages.
}
return parent::report($e);
}
示例11: report
/**
* Report or log an exception.
*
* This is a great spot to send exceptions to Sentry, Bugsnag, etc.
*
* @param \Exception $e
* @return void
*/
public function report(Exception $e)
{
if (strtolower(getenv('SLACK_ENABLE')) === 'true') {
Slack::send("Exception: {$e->getMessage()} on file {$e->getFile()} at line {$e->getLine()}");
}
return parent::report($e);
}
示例12: report
public function report(Exception $e)
{
if ($this->shouldReport($e)) {
app('bugvel')->send($e);
}
return parent::report($e);
}
示例13: report
/**
* Report or log an exception.
*
* This is a great spot to send exceptions to Sentry, Bugsnag, etc.
*
* @param \Exception $e
* @return void
*/
public function report(Exception $e)
{
if ($e instanceof ModelNotFoundException) {
abort(404);
}
return parent::report($e);
}
示例14: report
/**
* Report or log an exception.
*
* This is a great spot to send exceptions to Sentry, Bugsnag, etc.
*
* @param \Exception $e
* @return void
*/
public function report(Exception $e)
{
if (self::shouldReport($e)) {
TraceToSlack::trace($e);
}
return parent::report($e);
}
示例15: report
/**
* Report or log an exception.
*
* This is a great spot to send exceptions to Sentry, Bugsnag, etc.
*
* @param \Exception $e
* @return void
*/
public function report(Exception $e)
{
if (!config('app.debug')) {
Log::error($e);
}
return parent::report($e);
}