Ends the given span with status ERROR and records the error
span to be ended
Optional
error to be recorded
Ends the given span with status ERROR and records the error