Skip to content

Commit 8a95f95

Browse files
mitchierichiemitchierichie
authored andcommitted
fix phpstan and php-cs-fixer errors
1 parent d6f5e3e commit 8a95f95

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/Aws/src/AwsSdkInstrumentation.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
use Aws\Middleware;
99
use Aws\ResultInterface;
1010
use Closure;
11-
use Error;
1211
use GuzzleHttp\Promise;
1312
use OpenTelemetry\API\Instrumentation\InstrumentationInterface;
1413
use OpenTelemetry\API\Instrumentation\InstrumentationTrait;
@@ -18,6 +17,7 @@
1817
use OpenTelemetry\API\Trace\TracerProviderInterface;
1918
use OpenTelemetry\Context\Propagation\TextMapPropagatorInterface;
2019
use Psr\Http\Message\RequestInterface;
20+
use Stringable;
2121
use Throwable;
2222

2323
/**
@@ -197,10 +197,10 @@ private function normalizeReason(mixed $reason): ?string
197197
return $reason->getMessage();
198198
}
199199

200-
try {
201-
return strval($reason);
202-
} catch (Error) {
200+
if (is_object($reason) && ! $reason instanceof Stringable) {
203201
return null;
204202
}
203+
204+
return (string) $reason;
205205
}
206206
}

0 commit comments

Comments
 (0)