module Repobrowse::Error

Copyright (C) 2017-2018 all contributors <repobrowse-public@80x24.org> License: AGPL-3.0+ <www.gnu.org/licenses/agpl-3.0.txt>

Public Instance Methods

r404(r) click to toggle source
# File lib/repobrowse/error.rb, line 12
def r404(r)
  b = "Not Found\n"
  h = {
    'Content-Type' => -'text/plain; charset=UTF-8',
    'Content-Length' => -(b.size.to_s),
  }
  r.halt [ 404, h, [ b ] ]
end
r_err(r, msg) click to toggle source
# File lib/repobrowse/error.rb, line 6
def r_err(r, msg)
  r.env['rack.logger']&.error(msg)
  b = "Internal server error\n"
  r.halt [ 500, { 'Content-Type' => 'text/plain; charset=UTF-8' }, [ b ] ]
end