PHP error handling and auto page reloads in Sage 10

Hey all,

I’ve been making the switch to using Sage 10 on new themes and trying to get the DX working as smoothly as on Sage 9. In Sage 9, I would use WPS (Whoops, GitHub - Rarst/wps: WordPress plugin for whoops error handler.) for error handling which would allow me to still have auto refresh working when a PHP error occurs. Right now by default on Sage 10, I get a Symphony error page which doesn’t include the js needed to refresh the page when I fix the error. This means that I manually have to refresh the page on every device if I make a PHP typo or other mistake which I can’t imagine is the intended behavior. I tried using WPS as a WP plugin as I normally would but I’m getting the following errors:

Fatal error: Uncaught Error: Call to undefined method Whoops\Run::appendHandler() in /Users/bastiaan/Local Sites/mysite/app/public/wp-content/plugins/acorn/src/Illuminate/Foundation/Exceptions/Handler.php on line 535
Fatal error: Uncaught Error: Call to undefined function Whoops\Exception\xdebug_is_enabled() in /Users/bastiaan/Local Sites/mysite/app/public/wp-content/plugins/wps/vendor/filp/whoops/src/Whoops/Exception/Inspector.php on line 254

I am building sites for deployment on Flywheel so I’m using Local by Flywheel, not using Trellis or Bedrock for this reason.

Is there some obvious solution I am missing?

Thanks!

EDIT: I am on Sage 10.1.7, Bud 5.8.7, Acorn 2.0.3 (used as a WP Plugin)

1 Like

Thank you! Yes I am also getting this.

I asked this in the discord for supporters, I thought for sure I’d missed something simple

Should the symfony exception page be reloading when bud issues its refresh after recompiling?

got this response

should it be, or are you wanting it to be?

should it be? no, it shouldn’t. the error page has no idea that you’re in a dev session and would need to trigger a reload

I would love to have this reload automatically like it used to. Often while working on ACF blocks or other php customizations it will detect the change and reload but I’m not ready for it, so there are PHP errors. And I thought for sure the HMR would still be injected and recover but it never does.

Yeah, I guess the problem is that the error page doesn’t have the bud js injected so can’t trigger a subsequent reload. Do all these people using sage 10 really just manually refresh the page after every PHP error?