aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/friends.js
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2016-08-23 14:37:36 +0200
committerChocobozzz <florian.bigard@gmail.com>2016-08-23 14:37:36 +0200
commit39f87cb21689a912559d0498641db7d2de4a784d (patch)
tree83d0b98b63dcfd62fee783dda9cc2027e1a090c3 /server/lib/friends.js
parent52672600223d840ab123cd48c4c4d0457ac2e1a1 (diff)
downloadPeerTube-39f87cb21689a912559d0498641db7d2de4a784d.tar.gz
PeerTube-39f87cb21689a912559d0498641db7d2de4a784d.tar.zst
PeerTube-39f87cb21689a912559d0498641db7d2de4a784d.zip
Server: catch JSON.parse exceptions
Diffstat (limited to 'server/lib/friends.js')
-rw-r--r--server/lib/friends.js7
1 files changed, 6 insertions, 1 deletions
diff --git a/server/lib/friends.js b/server/lib/friends.js
index 667055d4c..6c4383d8e 100644
--- a/server/lib/friends.js
+++ b/server/lib/friends.js
@@ -198,7 +198,12 @@ function getForeignPodsList (url, callback) {
198 request.get(url + path, function (err, response, body) { 198 request.get(url + path, function (err, response, body) {
199 if (err) return callback(err) 199 if (err) return callback(err)
200 200
201 callback(null, JSON.parse(body)) 201 try {
202 const json = JSON.parse(body)
203 return callback(null, json)
204 } catch (err) {
205 return callback(err)
206 }
202 }) 207 })
203} 208}
204 209