Skip to content

Commit

Permalink
add exception handling for cloudflare error.
Browse files Browse the repository at this point in the history
  • Loading branch information
egg- committed Nov 10, 2020
1 parent 4819db6 commit 2fd8589
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/courier/jnt.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ module.exports = function () {
}

try {
if (res.statusCode !== 200) {
return cb(tracker.error(res.statusMessage))
}
var result = parser.trace(JSON.parse(body.data))
cb(result ? null : tracker.error(tracker.ERROR.INVALID_NUMBER), result)
} catch (e) {
Expand Down

0 comments on commit 2fd8589

Please sign in to comment.