Permalink
Browse files

Better error reporting

  • Loading branch information...
fent committed Feb 6, 2012
1 parent 2ab9779 commit e853b648efaf731f5f43013e7611da7de4269b02
Showing with 6 additions and 4 deletions.
  1. +2 −2 lib/youtube-dl.js
  2. +1 −1 package.json
  3. +3 −1 test/info.js
View
@@ -173,7 +173,7 @@ exports.download = function(url, dest, args) {
});
youtubedl.stderr.on('data', function(data) {
- data = data.toString();
+ data = data.toString().trim();
var err = new Error(data.substring(7, data.length - 1));
emitter.emit('error', err);
});
@@ -232,7 +232,7 @@ module.exports.info = function(url, callback, args) {
});
youtubedl.stderr.on('data', function(data) {
- data = data.toString();
+ data = data.toString().trim();
err = new Error(data.substring(7, data.length - 1));
});
View
@@ -2,7 +2,7 @@
"name": "youtube-dl",
"description": "youtube-dl driver for node",
"keywords": ["youtube", "video", "download"],
- "version": "1.2.1",
+ "version": "1.2.2",
"repository": {
"type": "git",
"url": "git://github.com/fent/node-youtube-dl.git"
View
@@ -7,10 +7,12 @@ var vows = require('vows')
vows.describe('info').addBatch({
'from a video': {
'topic': function() {
- ytdl.info(video, this.callback);
+ ytdl.info(video, this.callback, ['-f', '18/22/37/38']);
},
'info returned': function(err, info) {
+ assert.isNull(err);
+ assert.isObject(info);
assert.include(info, 'title');
assert.isString(info.title);
assert.include(info, 'url');

0 comments on commit e853b64

Please sign in to comment.