Created
October 5, 2023 11:29
-
-
Save skurfuerst/8c82e303689cebe2bce9ee9f5f1e9a16 to your computer and use it in GitHub Desktop.
Custom Throwable Storage to prevent exceptions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace MyPackage\Site; | |
use Neos\Flow\Log\ThrowableStorage\FileStorage; | |
use Neos\Media\Exception\NoThumbnailAvailableException; | |
/* | |
After implementing Kaleidoscope for Images and SourceSets we got an uncontrollably growing exception folder | |
when testing with prod-db-dump on staging, which caused a content-release | |
to fail and made the neos-container grow infiniteley. | |
We do not longer log this specific Exception, but it will be shown on the page, if it occurs. | |
*/ | |
class CustomThrowableStorage extends FileStorage { | |
public function logThrowable(\Throwable $throwable, array $additionalData = []) { | |
if($throwable instanceof NoThumbnailAvailableException) { | |
return ''; | |
} | |
return parent::logThrowable($throwable, $additionalData); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Neos: | |
Flow: | |
log: | |
# This block is needed for overwriting the ThrowableStorage to our own CustomThrowableStorage. | |
# For Documentation see: MyPackage/Site/Classes/CustomThrowableStorage.php | |
throwables: | |
storageClass: MyPackage\Site\CustomThrowableStorage | |
renderRequestInformation: true | |
optionsByImplementation: | |
'MyPackage\Site\CustomThrowableStorage': | |
storagePath: '%FLOW_PATH_DATA%Logs/Exceptions' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment