Skip to content

Commit

Permalink
feat(runner): provide error code on 'ECONNREFUSED' callback
Browse files Browse the repository at this point in the history
Add the error code as the second argument to the error callback. The information
can be useful in determining what to do on error when writing plugins against
the Karma API.
  • Loading branch information
Merott committed Jun 3, 2015
1 parent 63db4b0 commit 439bddb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions docs/dev/04-public-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,7 @@ runner.run({port: 9876}, function(exitCode) {
process.exit(exitCode);
});
```

## Callback function notes

- If there is an error, the error code will be provided as the second parameter to the error callback.
2 changes: 1 addition & 1 deletion lib/runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ exports.run = function(config, done) {
request.on('error', function(e) {
if (e.code === 'ECONNREFUSED') {
console.error('There is no server listening on port %d', options.port);
done(1);
done(1, e.code);
} else {
throw e;
}
Expand Down

0 comments on commit 439bddb

Please sign in to comment.