zwxi 11 months ago
parent
commit
b02270b322
2 changed files with 6 additions and 0 deletions
  1. 5 0
      controllers/chart.go
  2. 1 0
      controllers/excel.go

+ 5 - 0
controllers/chart.go

@@ -43,6 +43,7 @@ func (this *ChartController) ChartDetail()  {
 	resp, e := http.Get(url)
 	if e != nil {
 		err = fmt.Errorf("http Get err: %s", e.Error())
+		br.ErrMsg = err.Error()
 		return
 	}
 	defer resp.Body.Close()
@@ -50,20 +51,24 @@ func (this *ChartController) ChartDetail()  {
 	b, e := ioutil.ReadAll(resp.Body)
 	if e != nil {
 		err = fmt.Errorf("resp body read err: %s", e.Error())
+		br.ErrMsg = err.Error()
 		return
 	}
 	if len(b) == 0 {
 		err = fmt.Errorf("resp body is empty")
+		br.ErrMsg = err.Error()
 		return
 	}
 
 	result := new(models.BaseResponse)
 	if e = json.Unmarshal(b, &result); e != nil {
 		err = fmt.Errorf("result unmarshal err: %s\nresult: %s", e.Error(), string(b))
+		br.ErrMsg = err.Error()
 		return
 	}
 	if result.Ret != 200 {
 		err = fmt.Errorf("result: %s", string(b))
+		br.ErrMsg = err.Error()
 		return
 	}
 	br.Ret = 200

+ 1 - 0
controllers/excel.go

@@ -42,6 +42,7 @@ func (this *ExcelController) ExcelDetail()  {
 	resp, e := http.Get(url)
 	if e != nil {
 		err = fmt.Errorf("http Get err: %s", e.Error())
+		br.ErrMsg = err.Error()
 		return
 	}
 	defer resp.Body.Close()