Skip to content

Commit

Permalink
fix: fix 'cannot read property error of null' error
Browse files Browse the repository at this point in the history
  • Loading branch information
edvald committed Jul 30, 2019
1 parent 87dc922 commit c7bc3d9
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion garden-service/src/commands/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ export abstract class Command<T extends Parameters = {}, U extends Parameters =
export async function handleTaskResults(
log: LogEntry, taskType: string, results: ProcessResults,
): Promise<CommandResult<TaskResults>> {
const failed = Object.values(results.taskResults).filter(r => !!r.error).length
const failed = Object.values(results.taskResults).filter(r => r && r.error).length

if (failed) {
const error = new RuntimeError(`${failed} ${taskType} task(s) failed!`, {
Expand Down
2 changes: 1 addition & 1 deletion garden-service/src/garden.ts
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ export class Garden {
})
const taskResults = await this.processTasks(tasks)

const failed = Object.values(taskResults).filter(r => !!r.error)
const failed = Object.values(taskResults).filter(r => r && r.error)

if (failed.length) {
const messages = failed.map(r => `- ${r.name}: ${r.error!.message}`)
Expand Down
2 changes: 1 addition & 1 deletion garden-service/src/plugins/kubernetes/system.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ export async function prepareSystemServices(
forceBuild: force,
})

const failed = values(results.taskResults).filter(r => !!r.error).length
const failed = values(results.taskResults).filter(r => r && r.error).length

if (failed) {
throw new PluginError(`${provider.name}: ${failed} errors occurred when configuring environment`, {
Expand Down

0 comments on commit c7bc3d9

Please sign in to comment.