Skip to content

Commit b6fff14

Browse files
authored
configlet: catch every CatchableError (#697)
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
1 parent b7d44f6 commit b6fff14

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

src/configlet.nim

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import std/posix
22
import "."/[cli, completion/completion, fmt/fmt, info/info, generate/generate,
33
lint/lint, logger, sync/sync, uuid/uuid]
44

5-
proc main =
5+
proc configlet =
66
onSignal(SIGTERM):
77
quit(0)
88

@@ -28,4 +28,12 @@ proc main =
2828
of actInfo:
2929
info(conf)
3030

31-
main()
31+
proc main =
32+
try:
33+
configlet()
34+
except CatchableError:
35+
let msg = getCurrentExceptionMsg()
36+
showError(msg)
37+
38+
when isMainModule:
39+
main()

0 commit comments

Comments
 (0)