File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change 2
2
3
3
namespace Dingo \Api \Exception ;
4
4
5
+ use Closure ;
5
6
use Dingo \Api \Http \Request ;
6
7
use Exception ;
7
8
use Illuminate \Database \Eloquent \ModelNotFoundException ;
10
11
use Dingo \Api \Contract \Debug \ExceptionHandler ;
11
12
use Dingo \Api \Contract \Debug \MessageBagErrors ;
12
13
use Illuminate \Contracts \Debug \ExceptionHandler as IlluminateExceptionHandler ;
14
+ use Illuminate \Foundation \Exceptions \ReportableHandler ;
13
15
use Illuminate \Validation \ValidationException ;
14
16
use ReflectionFunction ;
15
17
use Symfony \Component \Console \Output \OutputInterface ;
@@ -397,4 +399,21 @@ public function setDebug($debug)
397
399
{
398
400
$ this ->debug = $ debug ;
399
401
}
402
+
403
+ /**
404
+ * Register a reportable callback.
405
+ *
406
+ * @param callable $reportUsing
407
+ * @return \Illuminate\Foundation\Exceptions\ReportableHandler
408
+ */
409
+ public function reportable (callable $ reportUsing )
410
+ {
411
+ if (! $ reportUsing instanceof Closure) {
412
+ $ reportUsing = Closure::fromCallable ($ reportUsing );
413
+ }
414
+
415
+ return tap (new ReportableHandler ($ reportUsing ), function ($ callback ) {
416
+ $ this ->reportCallbacks [] = $ callback ;
417
+ });
418
+ }
400
419
}
You can’t perform that action at this time.
0 commit comments