Skip to content

Commit

Permalink
Update api_media.js
Browse files Browse the repository at this point in the history
getMedia方法增加对异常处理
  • Loading branch information
p13766 authored and JacksonTian committed Jul 29, 2014
1 parent b9edb2d commit d272cd6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/api_media.js
Expand Up @@ -92,7 +92,10 @@ exports.getMedia = function (mediaId, callback) {
exports._getMedia = function (mediaId, callback) {
var url = this.fileServerPrefix + 'media/get?access_token=' + this.token.accessToken + '&media_id=' + mediaId;
urllib.request(url, {}, wrapper(function (err, data, res) {
// 不用处理err,因为wrapper函数处理过
// handle some err
if (err) {
return callback(err);
}
var contentType = res.headers['content-type'];
if (contentType === 'application/json') {
var ret;
Expand Down

0 comments on commit d272cd6

Please sign in to comment.