Software /
code /
clix
Changeset
84:1b4e64176288
clix.raw: Nicer error reporting from the sandbox.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 29 Jun 2012 20:50:01 +0200 |
parents | 83:040fadcc86f9 |
children | 85:8bc27e310e64 |
files | clix/raw.lua |
diffstat | 1 files changed, 8 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/clix/raw.lua Fri Jun 29 20:29:11 2012 +0200 +++ b/clix/raw.lua Fri Jun 29 20:50:01 2012 +0200 @@ -51,12 +51,19 @@ return end if data:sub(1,1) ~= "<" then - local chunk = assert(loadstring("return "..data, "@stdin")); + local chunk, err = loadstring("return "..data, "@stdin"); + if not chunk then + conn:error(err); + return; + end data = ""; setfenv(chunk, env); local ok, ret = pcall(chunk); if ok then data = ret + else + conn:error(ret); + return; end end if data then