Pretty error message when post does not have an author
Replace the basic error message when a post does not have an author with a nice looking error message page.
This commit is contained in:
parent
16054156a1
commit
9667aa1c3e
|
@ -41,7 +41,16 @@ local function edit_post(req)
|
|||
local err = util.do_sql(stmnt_author_of)
|
||||
if err ~= sql.ROW then
|
||||
stmnt_author_of:reset()
|
||||
error("No author found for story:" .. storyid)
|
||||
local msg = string.format("No author found for story: %d", storyid)
|
||||
log(LOG_ERR,msg)
|
||||
local response = pages.error{
|
||||
errcode = 404,
|
||||
errcodemsg = "Not Found",
|
||||
explanation = msg,
|
||||
should_traceback = true,
|
||||
}
|
||||
http_response(req,404,response)
|
||||
return
|
||||
end
|
||||
local data = stmnt_author_of:get_values()
|
||||
stmnt_author_of:reset()
|
||||
|
|
Loading…
Reference in New Issue