Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request Errors do not return error, just null #1

Closed
franky-continu opened this issue Dec 18, 2016 · 0 comments
Closed

Request Errors do not return error, just null #1

franky-continu opened this issue Dec 18, 2016 · 0 comments

Comments

@franky-continu
Copy link

Hi, in line 48, on the req.on('error') function handler. Could you please return an error?

    req.on('error', function(e) {
      console.log('problem with request: ' + e.message);
      if(callback) {
        callback(null);
      }
    });

This could return callback(e, null) or an object Job with the error code and messages like {status: 'error', error_code: e.code, error_message: e.message}

That way the code in the readme page which has the would always work with a proper return

var coconut = require('coconutjs');

coconut.createJob({
  'api_key': 'k-api-key',
  'conf': 'coconut.conf',
  'source': 'https://s3-eu-west-1.amazonaws.com/files.coconut.co/test.mp4',
  'vars': {'vid': 1234}
}, function(job) {
  if(job.status == 'ok') {
    console.log(job.id);
  } else {
    console.log(job.error_code);
    console.log(job.error_message);
  }
});

Thanking you in advance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants