diff options
author | Luke Shumaker <lukeshu@lukeshu.com> | 2021-02-22 22:03:29 -0700 |
---|---|---|
committer | Luke Shumaker <lukeshu@lukeshu.com> | 2021-02-22 23:05:49 -0700 |
commit | 89f98d13da60b4768f3f2e61594d027b009b920d (patch) | |
tree | 630f9feae81fdfc060e07729f4b153be0d4ce41e /ez.go | |
parent | 88017a8d5ca3739cf0216848f53d1e653bf63aaa (diff) |
ez reader: Fix error handling
Diffstat (limited to 'ez.go')
-rw-r--r-- | ez.go | 7 |
1 files changed, 3 insertions, 4 deletions
@@ -1,4 +1,4 @@ -// Copyright (C) 2017 Luke Shumaker <lukeshu@lukeshu.com> +// Copyright (C) 2017, 2021 Luke Shumaker <lukeshu@lukeshu.com> // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -51,7 +51,7 @@ type ezfir struct { var ezPanic = errors.New("everything is fine") -func (e *ezfir) Defer() error { +func (e *ezfir) Defer(err *error) { if e.err != nil { r := recover() if r == nil { @@ -60,9 +60,8 @@ func (e *ezfir) Defer() error { if r != ezPanic { panic(r) } - return e.err + *err = e.err } - return nil } func (e *ezfir) Errcheck(err error) { |