瀏覽代碼

Customers portal : Improved error message on autocomplete field when the portal configuration is incorrect

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@4262 a333f486-631f-4898-b8df-5754b55c2be0
glajarige 9 年之前
父節點
當前提交
a764e2e117
共有 1 個文件被更改,包括 12 次插入1 次删除
  1. 12 1
      sources/renderer/bootstrap/fieldrenderer/bsselectobjectfieldrenderer.class.inc.php

+ 12 - 1
sources/renderer/bootstrap/fieldrenderer/bsselectobjectfieldrenderer.class.inc.php

@@ -19,7 +19,10 @@
 
 namespace Combodo\iTop\Renderer\Bootstrap\FieldRenderer;
 
+use \Exception;
+use \CoreException;
 use \utils;
+use \IssueLog;
 use \Dict;
 use \UserRights;
 use \InlineImage;
@@ -134,7 +137,15 @@ EOF
 					// Retrieving field value
 					if ($this->oField->GetCurrentValue() !== null && $this->oField->GetCurrentValue() !== 0)
 					{
-						$oFieldValue = MetaModel::GetObject($sFieldValueClass, $this->oField->GetCurrentValue());
+						try
+						{
+							$oFieldValue = MetaModel::GetObject($sFieldValueClass, $this->oField->GetCurrentValue());
+						}
+						catch (CoreException $e)
+						{
+							IssueLog::Error('Could not retrieve object ' . $sFieldValueClass . '::' . $this->oField->GetCurrentValue() . ' for "' . $this->oField->GetId() . '" field.');
+							throw new Exception($e->getMessage(), $e->getCode(), $e->getPrevious());
+						}
 						$sFieldValue = $oFieldValue->GetName();
 					}
 					else