diff options
author | Ryan Dahl <ry@tinyclouds.org> | 2018-05-23 11:27:56 -0400 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2018-05-23 11:27:56 -0400 |
commit | 602ee0d5a1b092faf8f29cac0727a28640aac0b0 (patch) | |
tree | d050b0f2d12ec989d40305bf43d79a0633905b74 /util.go | |
parent | 08b327bf3afd7ad180fe807c4292c23cc6942b56 (diff) |
Better exception output
Diffstat (limited to 'util.go')
-rw-r--r-- | util.go | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -2,6 +2,7 @@ package main import ( "net/url" + "os" ) func assert(cond bool, msg string) { @@ -21,3 +22,10 @@ func check(e error) { panic(e) } } + +func exitOnError(err error) { + if err != nil { + os.Stderr.WriteString(err.Error()) + os.Exit(1) + } +} |