WebEngine icon indicating copy to clipboard operation
WebEngine copied to clipboard

Layers of error handling

Open g105b opened this issue 2 years ago • 0 comments

Each page should be able to have its own error() function alongside go and do.

The same goes for the _common page.

Then there should be individual files in page/_error:

  • 404.html // a special 404 page
  • 404.php // special logic to execute for the 404
  • @errorCode.html // any unhandled error will show this
  • @errorCode.php // any unhandled error will be picked up here
  • _common.php // handle logic for all errors here

Then we'll be able to have the following scenario:

  • As a developer
  • When I request an Entity in my page logic's go function like function go(ShopItem $item)
  • And the ShopItem is loaded in the ServiceLoader according to the DynamicPath
  • But there is no matching ShopItem for the current DynamicPath
  • Then the ServiceLoader throws a ShopItemNotFoundException
  • And the page logic's error(Throwable $reason) function is called
  • And the generic page/_error/@errorCode.html is displayed

g105b avatar Dec 07 '23 07:12 g105b