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

Error codes #7

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,23 @@ const handleIpRouteResults = (callback) => (error, stdout, stderr) => {
if (ip) {
callback(undefined, ip);
} else {
callback(new Error("Unable to find ip, perhaps call while not within a Docker container"), undefined);
const error = new Error("Unable to find ip, perhaps call while not within a Docker container");
error.code = "DOCKER_IP_NO_RESOLVE";
callback(error, undefined);
}
} else if (error) {

callback(error, undefined);
} else if (stderr) {

callback(new Error(stderr), undefined);
const error = new Error(stderr);
error.code = "DOCKER_IP_STDERR";
callback(error, undefined);
} else {

callback(new Error("No results or feedback given"), undefined);
const error = new Error("No results or feedback given");
error.code = "DOCKER_IP_EMPTY";
callback(error, undefined);
}
};

Expand Down