fix: return correct error code and fix error level

pull/21/head^2
TorchedSammy 2021-03-31 07:32:47 -04:00
parent 5500baf5b6
commit a9018a2740
1 changed files with 2 additions and 2 deletions

View File

@ -16,7 +16,7 @@ func Loader(L *lua.LState) int {
func LuaErr(L *lua.LState, code int) { func LuaErr(L *lua.LState, code int) {
// TODO: Error with a table, with path and error code // TODO: Error with a table, with path and error code
L.Error(lua.LNumber(code), 1) L.Error(lua.LNumber(code), 2)
} }
var exports = map[string]lua.LGFunction{ var exports = map[string]lua.LGFunction{
@ -30,7 +30,7 @@ func cd(L *lua.LState) int {
if err != nil { if err != nil {
switch err.(*os.PathError).Err.Error() { switch err.(*os.PathError).Err.Error() {
case "no such file or directory": case "no such file or directory":
LuaErr(L, 2) LuaErr(L, 1)
} }
} }