From 1a7dccb7577422a40ad8c81ccc8dd62e78eec75b Mon Sep 17 00:00:00 2001 From: sammyette <38820196+TorchedSammy@users.noreply.github.com> Date: Thu, 21 Oct 2021 20:49:00 -0400 Subject: [PATCH] feat(cd): show path in error messages --- golibs/fs/fs.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/golibs/fs/fs.go b/golibs/fs/fs.go index bc78e19..d99f345 100644 --- a/golibs/fs/fs.go +++ b/golibs/fs/fs.go @@ -37,7 +37,7 @@ func fcd(L *lua.LState) int { err := os.Chdir(strings.TrimSpace(path)) if err != nil { e := err.(*os.PathError).Err.Error() - L.RaiseError(e) + L.RaiseError(e + ": " + path) } return 0 @@ -57,7 +57,7 @@ func fmkdir(L *lua.LState) int { err = os.Mkdir(path, 0744) } if err != nil { - L.RaiseError(err.Error()) + L.RaiseError(err.Error() + ": " + path) } return 0 @@ -70,7 +70,7 @@ func fstat(L *lua.LState) int { pathinfo, err := os.Stat(path) if err != nil { - L.RaiseError(err.Error()) + L.RaiseError(err.Error() + ": " + path) return 0 } statTbl := L.NewTable() @@ -91,7 +91,7 @@ func freaddir(L *lua.LState) int { dirEntries, err := os.ReadDir(dir) if err != nil { - L.RaiseError(err.Error()) + L.RaiseError(err.Error() + ": " + path) return 0 } for _, entry := range dirEntries {