Skip to content

Commit

Permalink
feat(error) allow custom error text on error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
Tieske committed Mar 4, 2023
1 parent 260dfd4 commit 055bcfd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/pegasus/response.lua
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,10 @@ function Response:_getHeaders()
return table.concat(headers)
end

function Response:writeDefaultErrorMessage(statusCode)
function Response:writeDefaultErrorMessage(statusCode, errMessage)
self:statusCode(statusCode)
local content = string.gsub(DEFAULT_ERROR_MESSAGE, '{{ STATUS_CODE }}', statusCode)
self:write(string.gsub(content, '{{ STATUS_TEXT }}', STATUS_TEXT[statusCode]), false)
self:write(string.gsub(content, '{{ STATUS_TEXT }}', errMessage or STATUS_TEXT[statusCode]), false)

return self
end
Expand Down

0 comments on commit 055bcfd

Please sign in to comment.