mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-01 14:30:32 +02:00
[ticket/12683] Improve exception handling
PHPBB3-12683
This commit is contained in:
@@ -154,6 +154,7 @@ $lang = array_merge($lang, array(
|
||||
'CLI_SEARCHINDEX_DELETE_FAILURE' => 'Error deleting search index',
|
||||
'CLI_SEARCHINDEX_ACTION_IN_PROGRESS' => 'There is an action currently in progress. CLI doesn’t support incomplete index/delete actions, please solve it from the ACP.',
|
||||
'CLI_SEARCHINDEX_ACTIVE_NOT_INDEXED' => 'Active search backend isn’t indexed',
|
||||
'CLI_SEARCHINDEX_BACKEND_NOT_AVAILABLE' => 'Search backend isn’t available.',
|
||||
|
||||
// In all the case %1$s is the logical name of the file and %2$s the real name on the filesystem
|
||||
// eg: big_image.png (2_a51529ae7932008cf8454a95af84cacd) generated.
|
||||
|
@@ -215,8 +215,8 @@ $lang = array_merge($lang, array(
|
||||
2 => 'Downloaded %d times',
|
||||
),
|
||||
|
||||
'DI_SERVICE_NOT_FOUND' => 'No service found for class "%s" in collection.',
|
||||
'DI_MULTIPLE_SERVICE_DEFINITIONS' => 'More than one service definitions found for class "%s" in collection.',
|
||||
'DI_SERVICE_NOT_FOUND' => 'Service for class "%1$s" not found in collection.',
|
||||
'DI_MULTIPLE_SERVICE_DEFINITIONS' => 'More than one service definitions found for class "%1$s" in collection.',
|
||||
|
||||
'EDIT_POST' => 'Edit post',
|
||||
'ELLIPSIS' => '…',
|
||||
|
@@ -62,6 +62,8 @@ class create extends command
|
||||
$this->search_backend_factory = $search_backend_factory;
|
||||
$this->state_helper = $state_helper;
|
||||
|
||||
$this->language->add_lang(array('acp/common', 'acp/search'));
|
||||
|
||||
parent::__construct($user);
|
||||
}
|
||||
|
||||
@@ -118,6 +120,12 @@ class create extends command
|
||||
return symfony_command::FAILURE;
|
||||
}
|
||||
|
||||
if (!$search->is_available())
|
||||
{
|
||||
$io->error($this->language->lang('CLI_SEARCHINDEX_BACKEND_NOT_AVAILABLE', $search_backend));
|
||||
return symfony_command::FAILURE;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
$progress = $this->create_progress_bar($this->post_helper->get_max_post_id(), $io, $output, true);
|
||||
@@ -141,6 +149,8 @@ class create extends command
|
||||
}
|
||||
catch (\Exception $e)
|
||||
{
|
||||
$this->state_helper->clear_state(); // Unexpected error, cancel action
|
||||
$io->error($e->getMessage()); // Show also exception message like in acp
|
||||
$io->error($this->language->lang('CLI_SEARCHINDEX_CREATE_FAILURE', $name));
|
||||
return symfony_command::FAILURE;
|
||||
}
|
||||
|
@@ -62,6 +62,8 @@ class delete extends command
|
||||
$this->search_backend_factory = $search_backend_factory;
|
||||
$this->state_helper = $state_helper;
|
||||
|
||||
$this->language->add_lang(array('acp/common', 'acp/search'));
|
||||
|
||||
parent::__construct($user);
|
||||
}
|
||||
|
||||
@@ -118,6 +120,12 @@ class delete extends command
|
||||
return symfony_command::FAILURE;
|
||||
}
|
||||
|
||||
if (!$search->is_available())
|
||||
{
|
||||
$io->error($this->language->lang('CLI_SEARCHINDEX_BACKEND_NOT_AVAILABLE', $search_backend));
|
||||
return symfony_command::FAILURE;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
$progress = $this->create_progress_bar($this->post_helper->get_max_post_id(), $io, $output, true);
|
||||
@@ -141,6 +149,8 @@ class delete extends command
|
||||
}
|
||||
catch (\Exception $e)
|
||||
{
|
||||
$this->state_helper->clear_state(); // Unexpected error, cancel action
|
||||
$io->error($e->getMessage()); // Show also exception message like in acp
|
||||
$io->error($this->language->lang('CLI_SEARCHINDEX_DELETE_FAILURE', $name));
|
||||
return symfony_command::FAILURE;
|
||||
}
|
||||
|
@@ -1,4 +1,15 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* This file is part of the phpBB Forum Software package.
|
||||
*
|
||||
* @copyright (c) phpBB Limited <https://www.phpbb.com>
|
||||
* @license GNU General Public License, version 2 (GPL-2.0)
|
||||
*
|
||||
* For full copyright and license information, please see
|
||||
* the docs/CREDITS.txt file.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace phpbb\di\exception;
|
||||
|
||||
|
@@ -1,4 +1,15 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* This file is part of the phpBB Forum Software package.
|
||||
*
|
||||
* @copyright (c) phpBB Limited <https://www.phpbb.com>
|
||||
* @license GNU General Public License, version 2 (GPL-2.0)
|
||||
*
|
||||
* For full copyright and license information, please see
|
||||
* the docs/CREDITS.txt file.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace phpbb\di\exception;
|
||||
|
||||
|
Reference in New Issue
Block a user