Mercurial Hosting > luan
diff web/src/luan/modules/web/web_run.luan @ 326:db37d6aee4db
remove try-catch statement;
add Luan.try() and Luan.pcall();
git-svn-id: https://luan-java.googlecode.com/svn/trunk@327 21e917c8-12df-6dd8-5cb6-c86387c605b9
author | fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9> |
---|---|
date | Thu, 19 Mar 2015 00:01:57 +0000 |
parents | 78a6a71afbfd |
children | fb18724521d2 |
line wrap: on
line diff
--- a/web/src/luan/modules/web/web_run.luan Tue Mar 03 06:00:59 2015 +0000 +++ b/web/src/luan/modules/web/web_run.luan Thu Mar 19 00:01:57 2015 +0000 @@ -1,5 +1,6 @@ local Luan = require "luan:Luan" local load = Luan.load +local try = Luan.try local Io = require "luan:Io" local print = Io.print local Http = require "luan:web/Http" @@ -59,14 +60,17 @@ request = Http.request; response = Http.response; } - try - local run = load(code,"<web_run>",env) - run() - catch e do - Http.response.content_type = "text/plain" - print(e) - print() - print() - print_with_line_numbers(code) - end + try { + function() + local run = load(code,"<web_run>",env) + run() + end; + catch = function(e) + Http.response.content_type = "text/plain" + print(e) + print() + print() + print_with_line_numbers(code) + end; + } end