Inheritance: extends Illuminate\Support\Facades\Facade
コード例 #1
0
 /**
  * Render an exception into an HTTP response.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Exception  $e
  * @return \Illuminate\Http\Response
  */
 public function render($request, Exception $e)
 {
     if ($e instanceof \UnknownPlayerException) {
         Bugsnag::notifyException($e);
         return response()->view('error', ['error' => $e->getMessage()]);
     }
     if ($e instanceof \DestinyException) {
         Bugsnag::notifyException($e);
         return response()->view('error', ['error' => $e->getMessage(), 'bungie' => true]);
     }
     if ($e instanceof \DestinyLegacyPlatformException) {
         return response()->view('error', ['error' => $e->getMessage(), 'bungie' => true]);
     }
     if (\Config::get('app.debug')) {
         \Session::flash('alert', sprintf("%s (Line %d): %s", $e->getFile(), $e->getLine(), $e->getMessage()));
     } else {
         if (strlen($e->getMessage()) > 1) {
             \Session::flash('alert', $e->getMessage());
         }
     }
     if ($e instanceof ModelNotFoundException) {
         $e = new NotFoundHttpException($e->getMessage(), $e);
     }
     if (config('app.debug') && app()->environment() != 'testing') {
         return $this->renderExceptionWithWhoops($request, $e);
     }
     return parent::render($request, $e);
 }
コード例 #2
0
ファイル: Handler.php プロジェクト: vlsoprun/store
 /**
  * Render an exception into an HTTP response.
  *
  * @param  \Illuminate\Http\Request $request
  * @param  \Exception $exception
  * @return \Illuminate\Http\Response
  * @throws \InvalidArgumentException
  */
 public function render($request, Exception $exception)
 {
     Bugsnag::notifyException($exception);
     if (config('app.debug')) {
         $this->renderExceptionWithWhoops($request, $exception);
     }
     return parent::render($request, $exception);
 }
コード例 #3
0
 /**
  * Register any other events for your application.
  *
  * @param  \Illuminate\Contracts\Events\Dispatcher  $events
  * @return void
  */
 public function boot(DispatcherContract $events)
 {
     parent::boot($events);
     \Event::listen('Illuminate\\Cache\\Events\\KeyWritten', function ($event) {
         Bugsnag::leaveBreadcrumb('Cache written', 'process', ['key' => $event->key, 'value' => $event->value, 'ttl' => "{$event->minutes}mins"]);
     });
     Bugsnag::setAppVersion(version());
 }
コード例 #4
0
 /**
  * @param \Destiny\DestinyRequest[]|\Destiny\DestinyRequest $requests
  * @throws \DestinyException
  * @throws \Exception
  *
  * @return array
  */
 public function request($requests)
 {
     $multi = true;
     if ($requests instanceof DestinyRequest) {
         $multi = false;
         $requests = [$requests];
     }
     $batch = $responses = [];
     foreach ($requests as $key => $request) {
         if (!$request instanceof DestinyRequest) {
             throw new Exception('Invalid request');
         }
         if (!CACHE_ENABLED || $request->raw) {
             Cache::forget($request->key);
         }
         if ($request->cache && Cache::has($request->key)) {
             Debugbar::startMeasure("CACHE: " . $request->url);
             $responses[$key] = Cache::get($request->key);
             Debugbar::stopMeasure("CACHE: " . $request->url);
         } else {
             $req = $this->createRequest('GET', $request->url);
             $req->getEmitter()->attach($request);
             $batch[$key] = $req;
         }
     }
     if (count($batch)) {
         $keys = array_keys($batch);
         foreach (Pool::batch($this, $batch) as $i => $result) {
             $key = $keys[$i];
             $request = $requests[$key];
             if ($request instanceof DestinyRequest && $request->raw) {
                 $responses[$key] = $result;
                 continue;
             }
             if ($result instanceof Exception) {
                 if ($request->salvageable) {
                     $responses[$key] = null;
                 } else {
                     Cache::forget($request->key);
                     throw new DestinyException($result->getMessage(), $result->getCode(), $result);
                 }
             }
             if ($result instanceof Response) {
                 $response = json_decode($result->getBody()->getContents(), true);
                 if (array_get($response, 'ErrorStatus') !== 'Success') {
                     Cache::forget($request->key);
                     Bugsnag::setMetaData(['bungie' => $response]);
                     if (array_get($response, 'ErrorCode') === $this->destinyLegacyPlatformErrorCode) {
                         throw new \DestinyLegacyPlatformException(array_get($response, 'Message'), array_get($response, 'ErrorCode'));
                     } else {
                         if (array_get($response, 'ErrorCode') === $this->destinyPrivacyRestriction) {
                             $response = ['private' => true];
                         } else {
                             if ($request->salvageable) {
                                 $response = null;
                             } else {
                                 throw new DestinyException(array_get($response, 'Message'), array_get($response, 'ErrorCode'));
                             }
                         }
                     }
                 } else {
                     $response = array_get($response, 'Response');
                 }
                 if (empty($response)) {
                     Cache::forget($request->key);
                 }
                 if ($request->cache) {
                     Cache::put($request->key, $response, $request->cache);
                 }
                 $responses[$key] = $response;
             }
         }
     }
     return $multi ? $responses : array_shift($responses);
 }
コード例 #5
0
 /**
  * Execute the console command.
  *
  * @return void
  */
 public function fire()
 {
     Bugsnag::deploy($this->option('repository'), $this->option('branch'), $this->option('revision'));
     $this->info('Notified Bugsnag of the deploy!');
 }