- /** @var IWritableStorage $newstorage */
- $newstorage = DI::storageManager()->getWritableStorageByName($storagebackend);
+ try {
+ /** @var IWritableStorage $newstorage */
+ $newstorage = DI::storageManager()->getWritableStorageByName($storagebackend);
+ } catch (InvalidClassStorageException $storageException) {
+ notice(DI::l10n()->t('Storage backend, %s is invalid.', $storagebackend));
+ DI::baseUrl()->redirect('admin/storage');
+ }