1
0
mirror of https://github.com/lxsang/antd-web-apps synced 2025-09-23 10:11:59 +02:00

Merge pull request #19 from lxsang/master

enhance error handling
This commit is contained in:
Xuan Sang LE
2020-09-22 16:51:56 +02:00
committed by GitHub

View File

@@ -25,6 +25,10 @@ function CommentController:index(...)
result("")
return false
end
if not REQUEST.json then
fail("Invalid request")
return false
end
local rq = (JSON.decodeString(REQUEST.json))
if (rq) then
local pages, order = self.pages:find({exp = {["="] = {uri = rq.page}}})
@@ -82,6 +86,10 @@ function CommentController:post(...)
result("")
return false
end
if not REQUEST.json then
fail("Invalid request")
return false
end
local rq = (JSON.decodeString(REQUEST.json))
if rq then
local pages, order = self.pages:find({exp = {["="] = rq.page}})
@@ -136,6 +144,10 @@ function CommentController:preview(...)
result("")
return false
end
if not REQUEST.json then
fail("Invalid request")
return false
end
local rq = (JSON.decodeString(REQUEST.json))
if (rq and rq.data) then
result(process_md(rq.data))