Add more information about the error in the bbcode structure

This commit is contained in:
Visman 2021-12-24 19:18:17 +07:00
parent 7b922096f6
commit bfb4c413bd

View file

@ -14,6 +14,7 @@ use ForkBB\Models\Method;
use ForkBB\Models\BBCodeList\BBCodeList;
use ForkBB\Models\BBCodeList\Structure;
use RuntimeException;
use function \ForkBB\__;
class Update extends Method
{
@ -22,8 +23,8 @@ class Update extends Method
*/
public function update(int $id, Structure $structure): BBCodeList
{
if (null !== $structure->getError()) {
throw new RuntimeException('BBCode structure has error');
if (null !== ($error = $structure->getError())) {
throw new RuntimeException('BBCode structure has error (' . __($error) . ')');
}
$vars = [