From 9f1ad83c5197122038c0606ecd9eb449159cfa40 Mon Sep 17 00:00:00 2001 From: sammyette <38820196+TorchedSammy@users.noreply.github.com> Date: Wed, 19 May 2021 17:00:23 -0400 Subject: [PATCH] feat: print on unhandled err case for fs.cd --- golibs/fs/fs.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/golibs/fs/fs.go b/golibs/fs/fs.go index a1017a8..03f6576 100644 --- a/golibs/fs/fs.go +++ b/golibs/fs/fs.go @@ -1,6 +1,7 @@ package fs import ( + "fmt" "os" "strings" @@ -31,9 +32,13 @@ func cd(L *lua.LState) int { err := os.Chdir(strings.TrimSpace(path)) if err != nil { - switch err.(*os.PathError).Err.Error() { + switch e := err.(*os.PathError).Err.Error(); e { case "no such file or directory": LuaErr(L, 1) + default: + fmt.Printf("Found unhandled error case: %s", e) + fmt.Printf("Report this at https://github.com/Hilbis/Hilbish/issues with the title being: \"fs: unahndled error case %s\", and show what caused it.\n", e) + LuaErr(L, 213) } }