diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2022-03-15 21:24:58 +1100 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2022-03-17 19:13:40 +1100 |
commit | 729da3549ab7792b2ce0f89e2f37b2ad03efd8e6 (patch) | |
tree | 416bb13e46047984bf00e78b173731a0a9bc3c0d /vendor/github.com/go-errors/errors/stackframe.go | |
parent | 7bdd7088e796231503d26a8f0e52c96f2887e5b5 (diff) |
go mod vendor
Diffstat (limited to 'vendor/github.com/go-errors/errors/stackframe.go')
-rw-r--r-- | vendor/github.com/go-errors/errors/stackframe.go | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/vendor/github.com/go-errors/errors/stackframe.go b/vendor/github.com/go-errors/errors/stackframe.go index ef4a8b3f3..f420849d2 100644 --- a/vendor/github.com/go-errors/errors/stackframe.go +++ b/vendor/github.com/go-errors/errors/stackframe.go @@ -53,7 +53,7 @@ func (frame *StackFrame) Func() *runtime.Func { func (frame *StackFrame) String() string { str := fmt.Sprintf("%s:%d (0x%x)\n", frame.File, frame.LineNumber, frame.ProgramCounter) - source, err := frame.sourceLine() + source, err := frame.SourceLine() if err != nil { return str } @@ -63,21 +63,13 @@ func (frame *StackFrame) String() string { // SourceLine gets the line of code (from File and Line) of the original source if possible. func (frame *StackFrame) SourceLine() (string, error) { - source, err := frame.sourceLine() - if err != nil { - return source, New(err) - } - return source, err -} - -func (frame *StackFrame) sourceLine() (string, error) { if frame.LineNumber <= 0 { return "???", nil } file, err := os.Open(frame.File) if err != nil { - return "", err + return "", New(err) } defer file.Close() @@ -90,7 +82,7 @@ func (frame *StackFrame) sourceLine() (string, error) { currentLine++ } if err := scanner.Err(); err != nil { - return "", err + return "", New(err) } return "???", nil |