Custom Exception Handling - tech-shiv/osiset-laravel-shopify-app GitHub Wiki
As of v13.0.0, the "login" page was removed and all internal exceptions were modified to be agnostic.
There are currently a few exceptions:
ApiException
happens for API errorsMissingShopDomainException
happens for bad sessions or direct access to app outside of ShopifyChargeNotRecurringException
happens when trying to apply usage charges to a one-time chargeChargeNotRecurringOrOneTimeException
happens when trying to modify a usage charge by mistakeSignatureVerificationException
happens when the HMAC signature, proxy signature, or webhook signature does not validate
Without modification, in development, you will see the full exception stack from Laravel. On production, you will see Laravel's production handler for errors.
If you would like to handle these exceptions on your own, you can open app/Exceptions/Handler.php
in your app and modify the render
method:
public function render($request, Throwable $exception)
{
if ($exception instanceof \Osiset\ShopifyApp\Exceptions\MissingShopDomainException) {
return response()->view('errors.custom', [], 500);
}
// If you would like to capture ALL errors from this page
//
// if ($exception instanceof \Osiset\ShopifyApp\Exceptions\BaseException) {
// return response()->view('errors.custom', [], 500);
// }
return parent::render($request, $exception);
}
Now you are able to handle each exception, or all of them, in any manner you require.