Mercurial Hosting > luan
diff src/luan/modules/http/tools/Run.luan @ 1520:d9a5405a3102
try statement
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Sun, 21 Jun 2020 18:14:13 -0600 |
parents | 9eba6bf0163b |
children | fa066aaa068c |
line wrap: on
line diff
--- a/src/luan/modules/http/tools/Run.luan Fri Jun 19 20:10:47 2020 -0600 +++ b/src/luan/modules/http/tools/Run.luan Sun Jun 21 18:14:13 2020 -0600 @@ -1,7 +1,6 @@ local Luan = require "luan:Luan.luan" local error = Luan.error local load = Luan.load or error() -local try = Luan.try or error() local Io = require "luan:Io.luan" local print = Io.print or error() local String = require "luan:String.luan" @@ -68,23 +67,20 @@ <% end function Run.run(code,source_name) - return try { - function() - local run = load(code,source_name) - run() - return true - end - catch = function(e) - Http.response.reset() - Http.response.headers["content-type"] = "text/plain; charset=utf-8" - Io.stdout = Http.response.text_writer() - print(e) - print() - print() - print_with_line_numbers(code) - return false - end - } + try + local run = load(code,source_name) + run() + return true + catch e + Http.response.reset() + Http.response.headers["content-type"] = "text/plain; charset=utf-8" + Io.stdout = Http.response.text_writer() + print(e) + print() + print() + print_with_line_numbers(code) + return false + end end function Run.respond()