Mercurial Hosting > luan
changeset 1320:2c8d1d76a82a
PackageLuan.read() returns null for exceptions
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Mon, 04 Feb 2019 20:18:51 -0700 |
parents | f7355714742f |
children | 307e76ccd0d6 |
files | src/luan/modules/PackageLuan.java |
diffstat | 1 files changed, 12 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/luan/modules/PackageLuan.java Mon Feb 04 02:04:54 2019 -0700 +++ b/src/luan/modules/PackageLuan.java Mon Feb 04 20:18:51 2019 -0700 @@ -86,9 +86,18 @@ return mod; } - static String read(LuanState luan,String uri) throws LuanException { - LuanTable boot = (LuanTable)luan.require("luan:Boot.luan"); - return (String)Luan.first(boot.call("read",uri)); + static String read(LuanState luan,String uri) { + LuanTable boot; + try { + boot = (LuanTable)luan.require("luan:Boot.luan"); + } catch(LuanException e) { + throw new RuntimeException(e); + } + try { + return (String)Luan.first(boot.call("read",uri)); + } catch(LuanException e) { + return null; + } } public static void enableLoad(LuanState luan,String... mods) throws LuanException {