mirror of
https://github.com/processwire/processwire.git
synced 2025-08-10 00:37:02 +02:00
Fix issue processwire/processwire-issues#1326
This commit is contained in:
@@ -1308,7 +1308,7 @@ abstract class Fieldtype extends WireData implements Module {
|
|||||||
|
|
||||||
} catch(\PDOException $e) {
|
} catch(\PDOException $e) {
|
||||||
if($e->getCode() == 23000) {
|
if($e->getCode() == 23000) {
|
||||||
$message = sprintf($this->_('Value not allowed for field “%2$s” because it is already in use'), $field->name);
|
$message = sprintf($this->_('Value not allowed for field “%s” because it is already in use'), $field->name);
|
||||||
throw new WireDatabaseException($message, $e->getCode(), $e);
|
throw new WireDatabaseException($message, $e->getCode(), $e);
|
||||||
} else {
|
} else {
|
||||||
throw $e;
|
throw $e;
|
||||||
|
@@ -1365,7 +1365,7 @@ abstract class Wire implements WireTranslatable, WireFuelable, WireTrackable {
|
|||||||
if($text !== null) {
|
if($text !== null) {
|
||||||
if($text === true) $text = $msg;
|
if($text === true) $text = $msg;
|
||||||
$severe ? $this->error($text) : $this->warning($text);
|
$severe ? $this->error($text) : $this->warning($text);
|
||||||
if(strpos($text, $msg) === false) $msg = "$text - $msg";
|
if(strlen($msg) && strpos($text, $msg) === false) $msg = "$text - $msg";
|
||||||
}
|
}
|
||||||
if(in_array('exceptions', $config->logs) && $log) {
|
if(in_array('exceptions', $config->logs) && $log) {
|
||||||
$msg .= " (in " . str_replace($config->paths->root, '/', $e->getFile()) . " line " . $e->getLine() . ")";
|
$msg .= " (in " . str_replace($config->paths->root, '/', $e->getFile()) . " line " . $e->getLine() . ")";
|
||||||
|
Reference in New Issue
Block a user