Commit Graph
5 Commits
Author SHA1 Message Date
Adam Daley bbe5f89317 Stop Twig cache-directory write failures from flooding Sentry (#4277)
* Stop Twig cache-directory write failures from flooding Sentry

Twig's FilesystemCache throws a raw \RuntimeException when it can't
create or write to the configured template cache directory (data/cache),
which happens whenever a host's file permissions are wrong. That
exception was completely uncaught, so every affected visitor got a raw
500 and every occurrence was reported to Sentry as a code bug even
though it's a host misconfiguration we can't fix from within the app -
this is the same class of noise fixed for the cache backend in #4275,
just from a different code path (~60k events across 4 duplicate-shaped
Sentry issues: FOSSBILLING-EBW/J8N/EWG/EWV).

Box_App::convertCacheWriteFailure() now catches it in both
Box_AppClient::render() and Box_AppAdmin::render(), converts it into a
FOSSBilling\Exception with a new Cache-category error code (5002), and
rethrows anything else unchanged. ErrorPage marks 5002 report:false, so
Sentry stops seeing it while the visitor still gets a proper error page.

* Handle all three Twig cache-write failure messages, not just one

CodeRabbit review on #4277: Twig\Cache\FilesystemCache::write() throws
three different \RuntimeException messages for the same underlying
problem (missing/unwritable data/cache directory) - 'Unable to create
the cache directory', 'Unable to write in the cache directory', and
'Failed to write cache file'. convertCacheWriteFailure() only matched
the first, so the other two still fell through as raw, Sentry-reported
fatals. Match all three, with a regression case for each.

* Don't imply file permissions are the only cause of a cache write failure

CodeRabbit review on #4276 (same code as here): 'Failed to write cache
file' can also come from a full disk, a hit quota, or a read-only
mount, not just a permissions problem - the error message told the
admin to check permissions when that might not be the actual cause.
Broadened the wording to also point at disk space.
2026-09-04 09:57:25 +01:00
Adam Daley b364588f30 Harden release cleanup and updater integrity (#4166) 2026-08-15 15:27:15 +01:00
Adam Daley 59fae43df5 Fix client sessions, form fields, and error pages (#4011)
* Fix client sessions, form fields, and error pages

* Redirect authenticated clients away from login
2026-07-17 20:03:05 +01:00
Adam Daley 85cd7aac2a Modernize HTTP response flow (#3928)
* Modernize HTTP response flow

* Fix route matcher test spelling
2026-07-07 05:15:39 +01:00
Adam Daley 1efffee98b Handle Twig render failures as 500 errors (#3874)
* Handle Twig render failures as 500 errors

* Fix nested Twig loader error handling

* Fix AppClient missing page test stub
2026-07-02 11:48:08 +01:00