Mercurial Hosting > luan
comparison 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 |
comparison
equal
deleted
inserted
replaced
325:78a6a71afbfd | 326:db37d6aee4db |
---|---|
1 local Luan = require "luan:Luan" | 1 local Luan = require "luan:Luan" |
2 local load = Luan.load | 2 local load = Luan.load |
3 local try = Luan.try | |
3 local Io = require "luan:Io" | 4 local Io = require "luan:Io" |
4 local print = Io.print | 5 local print = Io.print |
5 local Http = require "luan:web/Http" | 6 local Http = require "luan:web/Http" |
6 local String = require "luan:String" | 7 local String = require "luan:String" |
7 local Html = require "luan:Html" | 8 local Html = require "luan:Html" |
57 end | 58 end |
58 local env = { | 59 local env = { |
59 request = Http.request; | 60 request = Http.request; |
60 response = Http.response; | 61 response = Http.response; |
61 } | 62 } |
62 try | 63 try { |
63 local run = load(code,"<web_run>",env) | 64 function() |
64 run() | 65 local run = load(code,"<web_run>",env) |
65 catch e do | 66 run() |
66 Http.response.content_type = "text/plain" | 67 end; |
67 print(e) | 68 catch = function(e) |
68 print() | 69 Http.response.content_type = "text/plain" |
69 print() | 70 print(e) |
70 print_with_line_numbers(code) | 71 print() |
71 end | 72 print() |
73 print_with_line_numbers(code) | |
74 end; | |
75 } | |
72 end | 76 end |