* Correct the bug when a API error is raised.

This commit is contained in:
dingguodong
2021-09-02 14:19:43 +08:00
parent d2a348b57b
commit cbf7227e89
+5 -2
View File
@@ -105,11 +105,14 @@ class mrModel extends model
$rawMR = $this->apiCreateMR($this->post->gitlabID, $this->post->sourceProject, $MRObject);
/* Another open merge request already exists for this source branch. */
/**
* Another open merge request already exists for this source branch.
* The type of variable `$rawMR->message` is array.
*/
if(isset($rawMR->message) and !isset($rawMR->iid))
{
$this->dao->delete()->from(TABLE_MR)->where('id')->eq($MRID)->exec();
return array('result' => 'fail', 'message' => sprintf($this->lang->mr->apiError->createMR, $rawMR->message));
return array('result' => 'fail', 'message' => sprintf($this->lang->mr->apiError->createMR, $rawMR->message[0]));
}
/* Create MR failed. */