def with_backtrace(message, message_without_backtrace)
      msg = message_without_backtrace
      error = message.error

      if self.backtrace && error && error.respond_to?(:backtrace)
        backtrace = if backtrace_limit
                      error.backtrace.take(backtrace_limit)
                    else
                      error.backtrace
                    end

        indented_backtrace = backtrace.map { |line| "    #{line}" }.to_a
        msg = indented_backtrace.insert(0, msg).join("\n")
      end

      msg
    end
def with_backtrace(message, message_without_backtrace)
      msg = message_without_backtrace
      error = message.error

      if self.backtrace && error && error.respond_to?(:backtrace)
        backtrace = if backtrace_limit
                      error.backtrace.take(backtrace_limit)
                    else
                      error.backtrace
                    end

        indented_backtrace = backtrace.map { |line| "    #{line}" }.to_a
        msg = indented_backtrace.insert(0, msg).join("\n")
      end

      msg
    end
Private: Method that takes an already formatted message and appends the
 backtrace to it if there is one and backtraces are enabled.

 message                   - The Message that is being formatted.
 message_without_backtrace - The formatted message before a backtrace may
                             be added.

 Returns a message with a backtrace optionally appended to it.