class ElasticAPM::ErrorBuilder

def build_exception(exception, handled: true)

def build_exception(exception, handled: true)
  error = Error.new
  error.exception = Error::Exception.new(exception, handled: handled)
  add_stacktrace error, :exception, exception.backtrace
  add_transaction_id error
  if (transaction = ElasticAPM.current_transaction)
    error.context = transaction.context.dup
  end
  error
end