def add_exception(exception, force: true)
      return exception unless force || fields[FIELD_ERROR].nil?

      add_fields(
        FIELD_ERROR => exception.class.name,
        FIELD_ERROR_MESSAGE => exception.message,
        FIELD_ERROR_TRACE => (exception.backtrace || []).join("\n")
      )
      exception
    end
def add_exception(exception, force: true)
      return exception unless force || fields[FIELD_ERROR].nil?

      add_fields(
        FIELD_ERROR => exception.class.name,
        FIELD_ERROR_MESSAGE => exception.message,
        FIELD_ERROR_TRACE => (exception.backtrace || []).join("\n")
      )
      exception
    end
@param flows [Flows] a list of {Flow} objects where this buffer eventually
   writes to
 @param buffering [Boolean] defines the buffering behavior of the buffer.
   When set to `true` we buffer all stored data which can be flushed to the
   {#flows} manually. In this mode, we still automatically flush newly
   added data to interested flows directly after adding it. When set to
   `false` we automatically flush to all flows as above but we will clear
   all stored data from the buffer afterwards.
   See {#buffering?} for details.
 @param allow_silent [Boolean] When set to `true` the data in this buffer
   will be flushed to the flows, even if there were just added fields or
   tags without any logged messages. If this is `false` and there were no
   messages logged with {#add_message}, the buffer will not be flushed but
   will be silently dropped.
 Extract useful data from an exception and add it to fields of the current
 buffer for structured logging. The following fields will be set:

  * `error` - The class name of the exception
  * `error_message` - The exception's message
  * `error_trace` - The backtrace of the exception, one frame per line

 The exception will not be added to the buffer's `message` field.
 Log it manually as a message if this is desired.

 By default, the details of subsequent exceptions will overwrite those of
 older exceptions in the current buffer. Only by the `force` argument to
 `false`, we will preserve existing exceptions.

 If a new exception was set, the buffer will be flushed to all
 auto_flushing flows automatically. If the buffer is not buffering log
 messages, it will also be flushed to the non auto_flushing flows and
 cleared afterwards.

 @param exception [Exception] an Exception object as caught by a
   `begin` ... `rescue` block.
 @param force [Boolean] set to `false` to preserve the details of an
   existing exception in the current buffer's fields, set to `true` to
   overwrite them.
 @return [Exception] the passed `exception`