-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #65 from jcchavezs/guards_malformed_propagated_con…
…text Guards for not to fail when receiving malformed trace information.
- Loading branch information
Showing
4 changed files
with
69 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
src/Zipkin/Propagation/Exceptions/InvalidTraceContextArgument.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
|
||
namespace Zipkin\Propagation\Exceptions; | ||
|
||
use InvalidArgumentException; | ||
|
||
final class InvalidTraceContextArgument extends InvalidArgumentException | ||
{ | ||
public static function forTraceId($traceId) | ||
{ | ||
return new self(sprintf('Invalid trace id, got %s', $traceId)); | ||
} | ||
|
||
public static function forSpanId($spanId) | ||
{ | ||
return new self(sprintf('Invalid span id, got %s', $spanId)); | ||
} | ||
|
||
public static function forParentSpanId($parentId) | ||
{ | ||
return new self(sprintf('Invalid parent span id, got %s', $parentId)); | ||
} | ||
|
||
public static function forSampled($isSampled) | ||
{ | ||
return new self(sprintf('is Sampled should be boolean or null, got %s', gettype($isSampled))); | ||
} | ||
|
||
public static function forDebug($isDebug) | ||
{ | ||
return new self(sprintf('isDebug should be boolean, got %s', gettype($isDebug))); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters