Skip to content

Commit 3222d74

Browse files
committed
Load exception handler only when restify call
1 parent 802a37a commit 3222d74

File tree

2 files changed

+15
-13
lines changed

2 files changed

+15
-13
lines changed

src/RestifyApplicationServiceProvider.php

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ class RestifyApplicationServiceProvider extends ServiceProvider
1414
public function boot()
1515
{
1616
$this->authorization();
17-
$this->registerExceptionHandler();
1817
$this->repositories();
1918
}
2019

@@ -32,18 +31,6 @@ protected function repositories()
3231
Restify::repositoriesFrom(app_path('Restify'));
3332
}
3433

35-
/**
36-
* Register Restify's custom exception handler.
37-
*
38-
* @return void
39-
*/
40-
protected function registerExceptionHandler()
41-
{
42-
if (config('restify.exception_handler') && class_exists(value(config('restify.exception_handler')))) {
43-
$this->app->bind(ExceptionHandler::class, value(config('restify.exception_handler')));
44-
}
45-
}
46-
4734
/**
4835
* Configure the Restify authorization services.
4936
*

src/RestifyServiceProvider.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace Binaryk\LaravelRestify;
44

5+
use Illuminate\Contracts\Debug\ExceptionHandler;
56
use Illuminate\Support\Facades\Route;
67
use Illuminate\Support\ServiceProvider;
78

@@ -17,6 +18,7 @@ class RestifyServiceProvider extends ServiceProvider
1718
public function boot()
1819
{
1920
$this->registerRoutes();
21+
$this->registerExceptionHandler();
2022
}
2123

2224
/**
@@ -48,4 +50,17 @@ public function defaultRoutes($config)
4850

4951
return $this;
5052
}
53+
54+
55+
/**
56+
* Register Restify's custom exception handler.
57+
*
58+
* @return void
59+
*/
60+
protected function registerExceptionHandler()
61+
{
62+
if (config('restify.exception_handler') && class_exists(value(config('restify.exception_handler')))) {
63+
$this->app->bind(ExceptionHandler::class, value(config('restify.exception_handler')));
64+
}
65+
}
5166
}

0 commit comments

Comments
 (0)