mirror of
https://github.com/lxsang/antd-web-apps
synced 2024-12-26 01:18:21 +01:00
enhance error handling
This commit is contained in:
parent
5dd6da0b29
commit
c4a3c425a8
@ -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))
|
||||
|
Loading…
Reference in New Issue
Block a user