improve error handling in TracingDirectivesHelper.extractSpan