Closed jcchavezs closed 6 years ago
After doing a couple implementation of OpenTracing, I did not have the necessity of using the SpanContextNotFound exception. More over, the flow when using this exception is cumbersome:
SpanContextNotFound
try { $context = $tracer->extract(...); } catch(Exception $e) { $context = SpanContext::createAsRoot(); }
whereas returning a null would be:
$context = $tracer->extract(...); if ($context === null) { ... // build root context }
Finally, the SpanContextNotFound does not add additional value to the failure, so returning a null is good enough.
null
Get rid of the exception and return null in such cases.
Ping @tedsuo @yurishkuro @beberlei @felixfbecker @lvht
+1, especially if childOf() can accept null, then you don't even need the null check.
Problem
After doing a couple implementation of OpenTracing, I did not have the necessity of using the
SpanContextNotFound
exception. More over, the flow when using this exception is cumbersome:whereas returning a null would be:
Finally, the
SpanContextNotFound
does not add additional value to the failure, so returning anull
is good enough.Proposal
Get rid of the exception and return
null
in such cases.Ping @tedsuo @yurishkuro @beberlei @felixfbecker @lvht