mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-11 03:04:09 +02:00
[ticket/12683] Improve exception handling
PHPBB3-12683
This commit is contained in:
@@ -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