Sha256: d2f7fc81e014fbe56d8c3dbed70bf2c622f64250d45b11642f0c5b64ca0c3fcf
Contents?: true
Size: 868 Bytes
Versions: 12
Compression:
Stored size: 868 Bytes
Contents
# frozen_string_literal: true module Pakyow module Actions class Dispatch def call(connection) catch :halt do Pakyow.apps.each do |app| if connection.path.start_with?(app.mount_path) app.call(connection) end end end unless connection.halted? error_404(connection) end rescue StandardError => error connection.error = error connection.logger.houston(error) error_500(connection) end private def error_404(connection, message = "404 Not Found") connection.status = 404 connection.body = StringIO.new(message) end def error_500(connection, message = "500 Server Error") connection.status = 500 connection.body = StringIO.new(message) end end end end
Version data entries
12 entries across 12 versions & 1 rubygems