Commit ce371ea6 authored by Côme Chilliet's avatar Côme Chilliet
Browse files

Merge branch '6071-rework-the-error-system' into '1.4-dev'

Resolve "Rework the error system"

See merge request fusiondirectory/fd!794
Showing with 31 additions and 0 deletions
+31 -0
...@@ -45,6 +45,11 @@ class FusionDirectoryError extends Error ...@@ -45,6 +45,11 @@ class FusionDirectoryError extends Error
]; ];
} }
public function __toString ()
{
return $this->getMessage();
}
public function computeMsgDialogParameters (): array public function computeMsgDialogParameters (): array
{ {
return [_('Error'), $this->htmlMessage, ERROR_DIALOG, static::formatTrace($this)]; return [_('Error'), $this->htmlMessage, ERROR_DIALOG, static::formatTrace($this)];
......
...@@ -76,6 +76,30 @@ class SimplePluginError extends FusionDirectoryError ...@@ -76,6 +76,30 @@ class SimplePluginError extends FusionDirectoryError
return $array; return $array;
} }
public function __toString ()
{
$msg = '';
if (isset($this->object)) {
$msg .= $this->object->getBaseObject()->dn.' > ';
}
if (isset($this->tab) && isset($this->tab->parent->by_name[get_class($this->tab)])) {
$msg .= $this->tab->parent->by_name[get_class($this->tab)].' > ';
}
if (isset($this->attribute)) {
$label = $this->attribute->getLabel();
if (empty($label)) {
$msg .= $this->attribute->getLdapName();
} else {
$msg .= $label;
}
}
return $msg.': '.$this->getMessage();
}
public function computeMsgDialogParameters (): array public function computeMsgDialogParameters (): array
{ {
$html = ''; $html = '';
......
...@@ -135,6 +135,8 @@ interface SimpleTab ...@@ -135,6 +135,8 @@ interface SimpleTab
/*! /*!
* \brief Deserialize values * \brief Deserialize values
*
* Returns TRUE or error
*/ */
public function deserializeValues (array $values, bool $checkAcl = TRUE); public function deserializeValues (array $values, bool $checkAcl = TRUE);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment