Merge remote-tracking branch 'origin/support/3.0' into develop

This commit is contained in:
Pierre Goiffon
2023-04-11 18:10:20 +02:00

View File

@@ -41,6 +41,7 @@ use Dict;
use DOMDocument; use DOMDocument;
use DOMXPath; use DOMXPath;
use Exception; use Exception;
use ExceptionLog;
use InlineImage; use InlineImage;
use IssueLog; use IssueLog;
use MetaModel; use MetaModel;
@@ -1116,6 +1117,7 @@ class ObjectFormManager extends FormManager
$sObjectClass = get_class($this->oObject); $sObjectClass = get_class($this->oObject);
$bExceptionLogged = false;
try { try {
// modification flags // modification flags
$bIsNew = $this->oObject->IsNew(); $bIsNew = $this->oObject->IsNew();
@@ -1137,6 +1139,14 @@ class ObjectFormManager extends FormManager
throw new Exception($e->getHtmlMessage()); throw new Exception($e->getHtmlMessage());
} }
catch (Exception $e) { catch (Exception $e) {
$aContext = [
'origin' => __CLASS__.'::'.__METHOD__,
'obj_class' => get_class($this->oObject),
'obj_key' => $this->oObject->GetKey(),
];
ExceptionLog::LogException($e, $aContext);
$bExceptionLogged = true;
if ($bIsNew) { if ($bIsNew) {
throw new Exception(Dict::S('Portal:Error:ObjectCannotBeCreated')); throw new Exception(Dict::S('Portal:Error:ObjectCannotBeCreated'));
} }
@@ -1196,11 +1206,12 @@ class ObjectFormManager extends FormManager
} }
} }
} }
catch (Exception $e) catch (Exception $e) {
{
$aData['valid'] = false; $aData['valid'] = false;
$aData['messages']['error'] += array('_main' => array($e->getMessage())); $aData['messages']['error'] += array('_main' => array($e->getMessage()));
IssueLog::Error(__METHOD__.' at line '.__LINE__.' : '.$e->getMessage()); if (false === $bExceptionLogged) {
IssueLog::Error(__METHOD__.' at line '.__LINE__.' : '.$e->getMessage());
}
} }
return $aData; return $aData;