Skip to content

Commit

Permalink
fix: throw if no actions found by pattern matching
Browse files Browse the repository at this point in the history
  • Loading branch information
vvagaytsev committed May 14, 2024
1 parent 8fc962a commit 4b86e05
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion core/src/graph/config-graph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,12 +153,15 @@ export abstract class BaseConfigGraph<
getModule(name: string, includeDisabled?: boolean) {
return this.moduleGraph.getModule(name, includeDisabled)
}

getModules(params: GetManyParams = {}) {
return this.moduleGraph.getModules(params)
}

withDependantModules(modules: GardenModule[]) {
return this.moduleGraph.withDependantModules(modules)
}

// and sanity...
//////////////////

Expand Down Expand Up @@ -248,14 +251,24 @@ export abstract class BaseConfigGraph<
return true
})

if (!ignoreMissing && names && names.length > found.length) {
if (ignoreMissing) {
return found
}

if ((names && names.length) || 0 > found.length) {
const missing = difference(names, foundNames)

throw new GraphError({
message: `Could not find one or more ${kind} actions: ${naturalList(missing)}`,
})
}

if (includeNames && includeNames.length > 0 && found.length === 0) {
throw new GraphError({
message: `Could not find one or more ${kind} actions for patterns: ${naturalList(includeNames)}`,
})
}

return found
}

Expand Down

0 comments on commit 4b86e05

Please sign in to comment.