Changeset

578:1a575bcbc843

mod_muc_log_http: Return a proper 404 Not Found page on missing pages instead of a traceback.
author Waqas Hussain <waqas20@gmail.com>
date Wed, 25 Jan 2012 04:20:08 +0500
parents 577:d26436bdfd5c
children 579:513aa6fed9e9
files mod_muc_log_http/muc_log_http/mod_muc_log_http.lua
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mod_muc_log_http/muc_log_http/mod_muc_log_http.lua	Tue Jan 24 19:25:06 2012 +0100
+++ b/mod_muc_log_http/muc_log_http/mod_muc_log_http.lua	Wed Jan 25 04:20:08 2012 +0500
@@ -86,7 +86,9 @@
 end
 
 function createDoc(body, title)
-	assert(body, "<nil> HTTP response");
+	if not body then
+		return { status = "404 Not Found", body = "<h1>Page Not Found</h1>Sorry, we couldn't find what you were looking for :(" };
+	end
 	body = body:gsub("%%", "%%%%");
 	return html.doc:gsub("###BODY_STUFF###", body)
 		:gsub("<title>muc_log</title>", "<title>"..(title and htmlEscape(title) or "Chatroom logs").."</title>");