Throw a more descriptive error temporarily

This commit is contained in:
Robin Malley 2021-01-26 02:12:42 +00:00
parent 4a99441008
commit c173fae026
1 changed files with 8 additions and 0 deletions

View File

@ -77,6 +77,14 @@ local function edit_post(req)
error("Failed to get a post's hash while trying to make it unlisted") error("Failed to get a post's hash while trying to make it unlisted")
end end
local hash = stmnt_hash:get_value(0) local hash = stmnt_hash:get_value(0)
-- TODO: Remove this
-- Posts added before the unlisted feature will throw errors
-- when their hash is used to display them, or their url's.
-- when proper database migration tools are in place, remove
-- this bit of code.
if hash == -1 then
error("This post was created before the unlisting feature was added. Temporarily, this breaks. You will be able to unlist it in the future.")
end
loc = loc .. "?pwd=" .. util.encode_unlisted(hash) loc = loc .. "?pwd=" .. util.encode_unlisted(hash)
end end
--Turning something from not unlisted to unlisted should dirty all these --Turning something from not unlisted to unlisted should dirty all these