Browse Source

Catch throwables when instantiating interface

When documenting a laravel-json-api/laravel api I was getting a `Illuminate\Contracts\Container\BindingResolutionException` and the docs were failing to build. This PR catches those exceptions.

To give specifics: one of the arguments in the controller method is `LaravelJsonApi\Contracts\Routing\Route` (an interface). In the context of `knuckleswtf/scribe` that interface is not instantiating because `app()` doesn't have a binding to the interface.
Devin 2 years ago
parent
commit
d79213b812
1 changed files with 5 additions and 1 deletions
  1. 5 1
      src/Extracting/UrlParamsNormalizer.php

+ 5 - 1
src/Extracting/UrlParamsNormalizer.php

@@ -201,7 +201,11 @@ class UrlParamsNormalizer
         }
 
         if (interface_exists($argumentClassName)) {
-            return app($argumentClassName);
+            try {
+                return app($argumentClassName);
+            } catch (\Throwable $e) {
+                return null;
+            }
         }
 
         return null;