Skip to content

Commit

Permalink
configlet: catch every CatchableError (#697)
Browse files Browse the repository at this point in the history
This also prepares for refactoring the error handling everywhere,
preferring to raise an exception rather than calling a deep `quit`.

Refs: #123
Refs: #325
Closes: #696
  • Loading branch information
ee7 authored Oct 28, 2022
1 parent b7d44f6 commit b6fff14
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/configlet.nim
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import std/posix
import "."/[cli, completion/completion, fmt/fmt, info/info, generate/generate,
lint/lint, logger, sync/sync, uuid/uuid]

proc main =
proc configlet =
onSignal(SIGTERM):
quit(0)

Expand All @@ -28,4 +28,12 @@ proc main =
of actInfo:
info(conf)

main()
proc main =
try:
configlet()
except CatchableError:
let msg = getCurrentExceptionMsg()
showError(msg)

when isMainModule:
main()

0 comments on commit b6fff14

Please sign in to comment.