Skip to content

Commit 18cd546

Browse files
committed
bug #182 [Plateform][HuggingFaces] Fix: throw exceptions directly instead of using 'return throw' (bernard-ng)
This PR was merged into the main branch. Discussion ---------- [Plateform][HuggingFaces] Fix: throw exceptions directly instead of using 'return throw' | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | Docs? | no | Issues | Fix #181 | License | MIT Replace `return throw` with direct throw statements for all exception cases in ResultConverter Commits ------- 5fa6362 Fix: throw exceptions directly instead of using 'return throw' in ResultConverter
2 parents 6c41cd2 + 5fa6362 commit 18cd546

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/platform/src/Bridge/HuggingFace/ResultConverter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,11 @@ public function convert(RawResultInterface|RawHttpResult $result, array $options
4747
{
4848
$httpResponse = $result->getObject();
4949
if (503 === $httpResponse->getStatusCode()) {
50-
return throw new RuntimeException('Service unavailable.');
50+
throw new RuntimeException('Service unavailable.');
5151
}
5252

5353
if (404 === $httpResponse->getStatusCode()) {
54-
return throw new InvalidArgumentException('Model, provider or task not found (404).');
54+
throw new InvalidArgumentException('Model, provider or task not found (404).');
5555
}
5656

5757
$headers = $httpResponse->getHeaders(false);

0 commit comments

Comments
 (0)