Showing
1 changed file
with
8 additions
and
3 deletions
@@ -149,9 +149,14 @@ exports.uploadFile = function (req, res) { | @@ -149,9 +149,14 @@ exports.uploadFile = function (req, res) { | ||
149 | formData: req.body | 149 | formData: req.body |
150 | }, function (error, httpResponse, body) { | 150 | }, function (error, httpResponse, body) { |
151 | if (!error && httpResponse.statusCode == 200) { | 151 | if (!error && httpResponse.statusCode == 200) { |
152 | - var json = JSON.parse(body); | ||
153 | - json.status = true; | ||
154 | - res.json(json); | 152 | + try{ |
153 | + var json = JSON.parse(body); | ||
154 | + json.status = true; | ||
155 | + res.json(json); | ||
156 | + return; | ||
157 | + }catch(err){ | ||
158 | + res.json({code:500,message:"上传失败"}); | ||
159 | + } | ||
155 | } else { | 160 | } else { |
156 | res.json(errBackMsg); | 161 | res.json(errBackMsg); |
157 | } | 162 | } |
-
Please register or login to post a comment