Skip to content

Commit 97f6487

Browse files
authored
Ignore 404 exceptions when removing label (#114)
* Ignore 404 exceptions when removing label * cs
1 parent 97c550a commit 97f6487

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/Api/Label/GithubLabelApi.php

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use App\Model\Repository;
66
use Github\Api\Issue\Labels;
7+
use Github\Exception\RuntimeException;
78
use Symfony\Contracts\Cache\CacheInterface;
89
use Symfony\Contracts\Cache\ItemInterface;
910

@@ -84,12 +85,14 @@ public function removeIssueLabel($issueNumber, string $label, Repository $reposi
8485
return;
8586
}
8687

87-
$this->labelsApi->remove(
88-
$repository->getVendor(),
89-
$repository->getName(),
90-
$issueNumber,
91-
$label
92-
);
88+
try {
89+
$this->labelsApi->remove($repository->getVendor(), $repository->getName(), $issueNumber, $label);
90+
} catch (RuntimeException $e) {
91+
// We can just ignore 404 exceptions.
92+
if (404 !== $e->getCode()) {
93+
throw $e;
94+
}
95+
}
9396

9497
// Update cache if already loaded
9598
if (isset($this->labelCache[$key])) {

0 commit comments

Comments
 (0)