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 Jan 11, 2024
1 parent 78df193 commit b06c1bf
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 @@ -142,10 +142,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 b06c1bf

Please sign in to comment.