ErrorServiceProvider.php 941 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php namespace App\Providers;
  2. use Exception;
  3. use Illuminate\Contracts\Logging\Log;
  4. use Illuminate\Support\ServiceProvider;
  5. use Illuminate\Contracts\Exception\Handler;
  6. class ErrorServiceProvider extends ServiceProvider {
  7. /**
  8. * Register any error handlers.
  9. *
  10. * @param Handler $handler
  11. * @param Log $log
  12. * @return void
  13. */
  14. public function boot(Handler $handler, Log $log)
  15. {
  16. // Here you may handle any errors that occur in your application, including
  17. // logging them or displaying custom views for specific errors. You may
  18. // even register several error handlers to handle different types of
  19. // exceptions. If nothing is returned, the default error view is
  20. // shown, which includes a detailed stack trace during debug.
  21. $handler->error(function(Exception $e) use ($log)
  22. {
  23. $log->error($e);
  24. });
  25. }
  26. /**
  27. * Register the service provider.
  28. *
  29. * @return void
  30. */
  31. public function register()
  32. {
  33. //
  34. }
  35. }