fix: handle error case of target in fs.cd not being a dir (closes #66)

pull/69/head
sammyette 2021-09-28 22:55:08 -04:00
parent a6a3962044
commit afcc6fe63a
No known key found for this signature in database
GPG Key ID: 50EE40A2809851F5
1 changed files with 2 additions and 0 deletions

View File

@ -35,6 +35,8 @@ func cd(L *lua.LState) int {
switch e := err.(*os.PathError).Err.Error(); e {
case "no such file or directory":
LuaErr(L, 1)
case "not a directory":
LuaErr(L, 2)
default:
fmt.Printf("Found unhandled error case: %s\n", e)
fmt.Printf("Report this at https://github.com/Rosettea/Hilbish/issues with the title being: \"fs: unhandled error case %s\", and show what caused it.\n", e)