From cbf7227e8915b828eec7c3cd9eb90e0ee2129dd6 Mon Sep 17 00:00:00 2001 From: dingguodong Date: Thu, 2 Sep 2021 14:19:43 +0800 Subject: [PATCH] * Correct the bug when a API error is raised. --- module/mr/model.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/module/mr/model.php b/module/mr/model.php index 0579eff71d..53703fb5dd 100644 --- a/module/mr/model.php +++ b/module/mr/model.php @@ -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. */