Skip to content

Commit 439bddb

Browse files
committedJun 3, 2015
feat(runner): provide error code on 'ECONNREFUSED' callback
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.
1 parent 63db4b0 commit 439bddb

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed
 

‎docs/dev/04-public-api.md

+4
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,7 @@ runner.run({port: 9876}, function(exitCode) {
2929
process.exit(exitCode);
3030
});
3131
```
32+
33+
## Callback function notes
34+
35+
- If there is an error, the error code will be provided as the second parameter to the error callback.

‎lib/runner.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ exports.run = function(config, done) {
5454
request.on('error', function(e) {
5555
if (e.code === 'ECONNREFUSED') {
5656
console.error('There is no server listening on port %d', options.port);
57-
done(1);
57+
done(1, e.code);
5858
} else {
5959
throw e;
6060
}

0 commit comments

Comments
 (0)
Please sign in to comment.