@@ -252,6 +252,26 @@ public function register(): void
252252 );
253253 });
254254
255+ $ this ->app ->singleton (
256+ ExceptionHandlerInterface::class,
257+ function (Application $ app ) {
258+ /** @var ConfigRepository */
259+ $ config = $ app ['config ' ];
260+
261+ return new ErrorHandler (
262+ $ app ,
263+ $ app ->make (ResourceMetadataCollectionFactoryInterface::class),
264+ $ app ->make (ApiPlatformController::class),
265+ $ app ->make (IdentifiersExtractorInterface::class),
266+ $ app ->make (ResourceClassResolverInterface::class),
267+ $ app ->make (Negotiator::class),
268+ $ config ->get ('api-platform.exception_to_status ' ),
269+ $ config ->get ('app.debug ' ),
270+ $ config ->get ('api-platform.error_formats ' )
271+ );
272+ }
273+ );
274+
255275 if (interface_exists (FieldsBuilderEnumInterface::class)) {
256276 $ this ->registerGraphQl ();
257277 }
@@ -294,26 +314,6 @@ private function registerGraphQl(): void
294314 $ app ->make (InflectorInterface::class)
295315 );
296316 });
297-
298- $ this ->app ->singleton (
299- ExceptionHandlerInterface::class,
300- function (Application $ app ) {
301- /** @var ConfigRepository */
302- $ config = $ app ['config ' ];
303-
304- return new ErrorHandler (
305- $ app ,
306- $ app ->make (ResourceMetadataCollectionFactoryInterface::class),
307- $ app ->make (ApiPlatformController::class),
308- $ app ->make (IdentifiersExtractorInterface::class),
309- $ app ->make (ResourceClassResolverInterface::class),
310- $ app ->make (Negotiator::class),
311- $ config ->get ('api-platform.exception_to_status ' ),
312- $ config ->get ('app.debug ' ),
313- $ config ->get ('api-platform.error_formats ' )
314- );
315- }
316- );
317317 }
318318
319319 /**
0 commit comments