if ($return_path) {
DI::baseUrl()->redirect($return_path);
}
- throw new HTTPException\InternalServerErrorException(DI::l10n()->t('Item wasn\'t stored. Last database error: %d %s', DBA::errorNo(), dba::errorMessage()));
+ throw new HTTPException\InternalServerErrorException(DI::l10n()->t('Item wasn\'t stored.'));
}
$datarray = Item::selectFirst(Item::ITEM_FIELDLIST, ['id' => $post_id]);
namespace Friendica\Database;
+use Exception;
use Friendica\Core\Config\Cache;
use Friendica\Core\System;
+use Friendica\DI;
use Friendica\Network\HTTPException\InternalServerErrorException;
use Friendica\Util\DateTimeFormat;
use Friendica\Util\Profiler;
private $affected_rows = 0;
protected $in_transaction = false;
protected $in_retrial = false;
+ protected $testmode = false;
private $relation = [];
public function __construct(Cache $configCache, Profiler $profiler, LoggerInterface $logger, array $server = [])
return $this->connected;
}
+ public function setTestmode(bool $test)
+ {
+ $this->testmode = $test;
+ }
/**
* Sets the logger for DBA
*
$error = $this->error;
$errorno = $this->errorno;
+ if ($this->testmode) {
+ throw new Exception(DI::l10n()->t('Database error %d "%s" at "%s"', $errorno, $error, $this->replaceParameters($sql, $args)));
+ }
+
$this->logger->error('DB Error', [
'code' => $this->errorno,
'error' => $this->error,
/** @var Database $dba */
$dba = $this->dice->create(Database::class);
+ $dba->setTestmode(true);
+
/** @var IConfig $config */
$this->config = $this->dice->create(IConfig::class);