Skip to content

Commit

Permalink
fix: don't skip igniter composition on error
Browse files Browse the repository at this point in the history
  • Loading branch information
zachdaniel committed Nov 1, 2024
1 parent ce58326 commit fe504b8
Showing 1 changed file with 20 additions and 24 deletions.
44 changes: 20 additions & 24 deletions lib/igniter.ex
Original file line number Diff line number Diff line change
Expand Up @@ -407,31 +407,27 @@ defmodule Igniter do
end

def compose_task(igniter, task_name, argv, fallback) do
if igniter.issues == [] do
task_name
|> Mix.Task.get()
|> case do
nil ->
cond do
is_function(fallback, 1) ->
fallback.(igniter)

is_function(fallback, 2) ->
# TODO: Remove this clause when `igniter/2` is removed
fallback.(igniter, argv || igniter.args.argv)

true ->
add_issue(
igniter,
"Task #{inspect(task_name)} could not be found."
)
end
task_name
|> Mix.Task.get()
|> case do
nil ->
cond do
is_function(fallback, 1) ->
fallback.(igniter)

is_function(fallback, 2) ->
# TODO: Remove this clause when `igniter/2` is removed
fallback.(igniter, argv || igniter.args.argv)

true ->
add_issue(
igniter,
"Task #{inspect(task_name)} could not be found."
)
end

task ->
compose_task(igniter, task, argv, fallback)
end
else
igniter
task ->
compose_task(igniter, task, argv, fallback)
end
end

Expand Down

0 comments on commit fe504b8

Please sign in to comment.