Made wrapped error accessible

This commit is contained in:
Magnus Åhall 2023-09-26 09:33:46 +02:00
parent 35249137c5
commit ebf3a9aa38

6
pkg.go
View File

@ -9,7 +9,7 @@ import (
) )
type Error struct { type Error struct {
err error Wrapped error
File string File string
Line int Line int
Data interface{} Data interface{}
@ -47,7 +47,7 @@ func (wrapped Error) Error() string {
"[%s:%d] %s", "[%s:%d] %s",
wrapped.File, wrapped.File,
wrapped.Line, wrapped.Line,
wrapped.err.Error(), wrapped.Wrapped.Error(),
) )
} }
@ -56,7 +56,7 @@ func create(err error, data interface{}) error {
file = file[baseDirLength+1:] file = file[baseDirLength+1:]
wrapped := Error{ wrapped := Error{
err: err, Wrapped: err,
File: file, File: file,
Line: line, Line: line,
Data: data, Data: data,