diff src/luan/modules/http/tools/Run.luan @ 1692:d6ec67fa4a61

tools for config files
author Franklin Schmidt <fschmidt@gmail.com>
date Tue, 14 Jun 2022 21:59:39 -0600
parents fa066aaa068c
children b82767112d8e
line wrap: on
line diff
--- a/src/luan/modules/http/tools/Run.luan	Mon Jun 13 18:01:51 2022 -0600
+++ b/src/luan/modules/http/tools/Run.luan	Tue Jun 14 21:59:39 2022 -0600
@@ -68,6 +68,16 @@
 <% 
 end
 
+function Run.print_error(e,code)
+	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)
+end
+
 function Run.run(code,source_name)
 	try
 		Http.response.headers["Content-Type"] = "text/plain; charset=utf-8"
@@ -75,13 +85,7 @@
 		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)
+		Run.print_error(e,code)
 		return false
 	end
 end