Skip to content

Commit

Permalink
fix(tasks): task errors had lost their color
Browse files Browse the repository at this point in the history
  • Loading branch information
edvald committed Dec 10, 2018
1 parent 663deea commit 66390e1
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion garden-service/src/task-graph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import * as Bluebird from "bluebird"
import * as PQueue from "p-queue"
import chalk from "chalk"
import * as yaml from "js-yaml"
import hasAnsi = require("has-ansi")
import { merge, padEnd, pick, flatten } from "lodash"
import { BaseTask, TaskDefinitionError } from "./tasks/base"

Expand Down Expand Up @@ -288,7 +289,13 @@ export class TaskGraph {
private logTaskError(node: TaskNode, err) {
const divider = padEnd("", 80, "—")
const error = toGardenError(err)
const msg = `\nFailed ${node.getDescription()}. Here is the output:\n${divider}\n${error.message}\n${divider}\n`
const errorMessage = error.message.trim()

const msg =
chalk.red(`\nFailed ${node.getDescription()}. Here is the output:\n${divider}\n`) +
(hasAnsi(errorMessage) ? errorMessage : chalk.red(errorMessage)) +
chalk.red(`\n${divider}\n`)

this.log.error({ msg, error })
}
}
Expand Down

0 comments on commit 66390e1

Please sign in to comment.