Skip to content

Commit

Permalink
fix(cmd new): better error message when day value is out of range or …
Browse files Browse the repository at this point in the history
…invalid
  • Loading branch information
TanklesXL committed Nov 30, 2022
1 parent c38e279 commit c8798bf
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/cmd/new.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ fn collect(x: #(Day, snag.Result(Nil))) -> String {
let day = int.to_string(x.0)
case
x.1
|> snag.context(string.append("error occurred when initializing day ", day))
|> snag.context("error occurred when initializing day " <> day)
|> result.map_error(snag.pretty_print)
{
Ok(_) -> "initialized day: " <> day
Expand All @@ -128,6 +128,7 @@ pub fn new_command() {
fn run(input: CommandInput) -> snag.Result(List(String)) {
input.args
|> parse.days
|> snag.context(string.join(["failed to initialize:", ..input.args], " "))
|> result.map(cmd.exec(_, cmd.Endless, do, snag.new, collect))
}

Expand Down

0 comments on commit c8798bf

Please sign in to comment.