function createEvent(transaction, error, timestamp, config) {
  const message = error[2]
  const errorClass = error[3]
  const errorParams = error[4]

  const intrinsicAttributes = _getErrorEventIntrinsicAttrs(
    transaction,
    errorClass,
    message,
    errorParams.intrinsics[ERROR_EXPECTED_PATH],
    timestamp,
    config
  )

  // the error structure created by createError() already performs filtering of custom
  // and agent attributes, so it is ok to just copy them
  const userAttributes = Object.assign(Object.create(null), errorParams.userAttributes)
  const agentAttributes = Object.assign(Object.create(null), errorParams.agentAttributes)

  return [intrinsicAttributes, userAttributes, agentAttributes]
}
Creates a structure for error event that is sent to the collector.
The error parameter is an output of the createError() function for a given exception.

@param {Transaction} transaction the current transaction
@param {Array} error createError() output
@param {string} timestamp the timestamp of the error event
@param {object} config agent configuration object
@returns {Array} an Array of different types of attributes [0] -> intrinsic, [1] -> user/custom, [2] -> agent