This repository was archived by the owner on Nov 30, 2022. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 376
Custom Exception Handling
Tyler King edited this page Sep 15, 2020
·
4 revisions
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:
-
ApiExceptionhappens for API errors -
MissingShopDomainExceptionhappens for bad sessions or direct access to app outside of Shopify -
ChargeNotRecurringExceptionhappens when trying to apply usage charges to a one-time charge -
ChargeNotRecurringOrOneTimeExceptionhappens when trying to modify a usage charge by mistake -
SignatureVerificationExceptionhappens 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.
road map
Welcome to the wiki!
Please see the homepage for a list of relevant pages.