Skip to content

Commit

Permalink
Merge pull request #48 from markbirbeck/46-improve-error-logging
Browse files Browse the repository at this point in the history
46 improve error logging
  • Loading branch information
markbirbeck authored Jul 19, 2018
2 parents feb67c4 + 7b099b1 commit 87045af
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [v0.8.0] - 2018-07-19
### Added
- Output details of any error on task failure (#46).

## [v0.7.1] - 2018-07-13
### Fixed
- Unable to obtain logs on remote swarm (#44).
Expand Down Expand Up @@ -56,4 +60,5 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
[v0.6.0]: https://github.com/markbirbeck/docker-job/compare/v0.5.0...v0.6.0
[v0.7.0]: https://github.com/markbirbeck/docker-job/compare/v0.6.0...v0.7.0
[v0.7.1]: https://github.com/markbirbeck/docker-job/compare/v0.7.0...v0.7.1
[Unreleased]: https://github.com/markbirbeck/docker-job/compare/v0.7.1...HEAD
[v0.8.0]: https://github.com/markbirbeck/docker-job/compare/v0.7.0...v0.8.0
[Unreleased]: https://github.com/markbirbeck/docker-job/compare/v0.8.0...HEAD
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "docker-job",
"version": "0.7.1",
"version": "0.8.0",
"description": "Run a single job as a Docker Service on Docker Swarm",
"bin": {
"dj": "./src/bin/cli.js"
Expand Down
8 changes: 7 additions & 1 deletion src/lib/service-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,13 @@ class ServiceClient {
await cb(task)
} catch(e) {
process.exitCode = -1
console.error(`${task.ID}: ${e.message}`)
/**
* If we've had an error then get the task's status for the error
* message:
*/

const state = await this.inspectTask(task.ID)
console.error(`${task.ID}: ${e.message}: "${state.Status.Err} (${state.Status.State})"`)
}
}
} while (!foundTask)
Expand Down

0 comments on commit 87045af

Please sign in to comment.