Skip to content

Update routing for error handling and better execution model #658

@g105b

Description

@g105b

There had been a few decisions held back over the last few months of development due to trying to be fully PSR-15 compliant. I've decided that PSR-15 is not a goal this project should have, due to the type of projects made in it (and the type of developers using it) not caring about the tool chain, and more caring about batteries-included development and prototyping.

Detaching from PSR-15 allows WebEngine's originally designed execution model to be fulfilled, which I've already put into place on the new-v5 branch, and then tidied up the codebase to something that everyone can read along with on new-v5--refactor.

I've integrated this branch into a couple of real world projects that were already running v4 and there are some integration issues. I'll note them here to keep track of. I want to spend some time getting this branch into a releaseable condition but I may have to keep putting it on the back burner as project work takes priority.

  • Dynamic path index pages are not routed (e.g. /page/apply/@organisation/index.php). This might be because there is no html counterpart... maybe, maybe not.
  • Errors should be emitted to STDERR so tools like Glitchtip can pick them up.
  • Error pages are not picked up by the router at all any more (page/_error/404.html, page/_error/500.html)
  • Ending responses early is not handled. For example where there's the new Json::error functionality, there should be a callback exposed on the Response/Dispatcher object to end the response early, without having to have any die/exit statements in the project code.
  • CSRF isn't currently automated. Should it be? I think so, but maybe there should be a directory-wide opt out for existing projects that heavily use client side fetches (e.g. AC's /apply directory).
  • Error responses should have their own HTMLDocument and go functions routed automatically.

Metadata

Metadata

Assignees

Labels

maintenanceCodebase upkeep, dependency bumps, versioning choresrefactorInternal code restructuring without behaviour change

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions