mirror of https://github.com/Hilbis/Hilbish
fix: return correct error code and fix error level
parent
5500baf5b6
commit
a9018a2740
|
@ -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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue