question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Err first standard

See original GitHub issue

I’d like to use Bluebirds Promise.promisify.

import Promise from 'bluebird'
import cmd from 'node-cmd'

const getAsync = Promise.promisify(cmd.get, { multiArgs: true, context: cmd })

getAsync('node -v').then(data => {
  console.log('cmd data', data)
}).catch(err => {
  console.log('cmd err', err)
})

This fails I think, because node-cmd doesn’t use the standard node error-first pattern which Bluebird wants:

The node function should conform to node.js convention of accepting a callback as last argument and calling that callback with error as the first argument and success value on the second argument.

The above code calls catch but actually displays the contents of data.

Any plans to switch to standard node-style error-first callbacks…?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
RIAEvangelistcommented, Apr 16, 2017

merged and released. Thank you 😃

0reactions
RIAEvangelistcommented, Apr 16, 2017

the nvm was because I realised I made a dumb comment. It was obvious why it was breaking once I looked.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Standard error - Wikipedia
The standard error (SE) of a statistic is the standard deviation of its sampling distribution or an estimate of that standard deviation.
Read more >
What is the Standard Error of a Sample ? - Statistics How To
The standard error(SE) is very similar to standard deviation. Both are measures of spread. The higher the number, the more spread out your...
Read more >
The Node.js Way - Understanding Error-First Callbacks
The error-first pattern was introduced into Node core to solve this very problem, and has since spread to become today's standard.
Read more >
Error-First Callback in Node.js - GeeksforGeeks
The first argument in the function is reserved for the error object. If any error has occurred during the execution of the function,...
Read more >
Standard Error in R (2 Example Codes) - Statistics Globe
Now, let's apply this standard error function. First, we need to create a numeric example vector in R… x <- c( ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found