1
0
mirror of https://github.com/lxsang/antd-web-apps synced 2024-12-26 17:38:21 +01: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
commit dd3e56fb01
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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))