Sha256: e019641a9b9395eaa0067c01132d566991fbe46b82f9a5cac9676cf45097c613
Contents?: true
Size: 973 Bytes
Versions: 1
Compression:
Stored size: 973 Bytes
Contents
# frozen_string_literal: true module Logux class ErrorRenderer attr_reader :exception def initialize(exception) @exception = exception end def message case exception when Logux::WithMetaError build_message(exception, exception.meta.id) when Logux::UnauthorizedError build_message(exception, exception.message) when StandardError # some runtime error that should be fixed render_stardard_error(exception) end end private def render_stardard_error(exception) if Logux.configuration.render_backtrace_on_error ['error', exception.message + "\n" + exception.backtrace.join("\n")] else ['error', 'Please check server logs for more information'] end end def build_message(exception, additional_info) [ exception.class.name.demodulize.camelize(:lower).gsub(/Error/, ''), additional_info ] end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
logux-rack-0.1.0 | lib/logux/error_renderer.rb |