浏览代码

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 年之前
父节点
当前提交
d79213b812
共有 1 个文件被更改,包括 5 次插入1 次删除
  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;