Ends the given span with status ERROR and records the error

  • Parameters

    • span: undefined | Span

      span to be ended

    • Optionalerror: unknown

      error to be recorded

    Returns void