Skip to content

Commit

Permalink
fix: Handle error from fetching templates
Browse files Browse the repository at this point in the history
  • Loading branch information
attakei committed Dec 4, 2021
1 parent c1487d7 commit 345a86a
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions src/gigipkg/cli.nim
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,21 @@ proc main*(): int =
stderr.writeLine("No targets is specified.")
return 1

let templates = newTemplatesFromWeb()
stdout.writeLine("### " & PKG_NAME & " version " & PKG_VERSION)
stdout.writeLine("### command with: " & targets.join(" "))
for t in targets:
if not templates.hasKey(t):
stdout.writeLine("## '" & t & "' is not exists")
continue
stdout.writeLine("")
stdout.writeLine(templates[t].output)
try:
let templates = newTemplatesFromWeb()
stdout.writeLine("### " & PKG_NAME & " version " & PKG_VERSION)
stdout.writeLine("### command with: " & targets.join(" "))
for t in targets:
if not templates.hasKey(t):
stdout.writeLine("## '" & t & "' is not exists")
continue
stdout.writeLine("")
stdout.writeLine(templates[t].output)
except PuppyError:
let ex = getCurrentException()
stderr.writeLine("Failured to fetch ignore templates.")
stderr.writeLine("Please see error messages and check your environment if you need.")
stderr.writeLine("Message: " & ex.msg)
return 1

return 0

0 comments on commit 345a86a

Please sign in to comment.