ShopApiPlugin icon indicating copy to clipboard operation
ShopApiPlugin copied to clipboard

Handle general exceptions at one place

Open CSchulz opened this issue 5 years ago • 1 comments

I am wondering if extracting error handling of exceptions like ChannelNotFoundException as generic approach for the shop api would be suitable. At the moment every resource handles on its own such stuff.

if some api needs another kind of handling f.e. ChannelNotFoundException the developer has to implement it on its own.

CSchulz avatar Sep 23 '19 16:09 CSchulz

I have implemented a very straight forward approach under the assumption that if the channel can not be found then the route does not exist (in our case this means that the hostname does not resolve to a channel). Then the local thing is to return a 404.

This we did with an event listener listening to kernel.exception. And then handling the stuff accordingly.

mamazu avatar Jul 27 '20 20:07 mamazu