Sha256: cf66d0a99002f7fae8ae05de254c8d7526c239d6d14262a6d54ed224c5483130
Contents?: true
Size: 972 Bytes
Versions: 1
Compression:
Stored size: 972 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 look 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_rails-0.1.0 | lib/logux/error_renderer.rb |