Skip to content

Commit

Permalink
DeleteDowntimesCommandForm: Ignore 404's
Browse files Browse the repository at this point in the history
fixes #5183
  • Loading branch information
nilmerg committed Aug 7, 2024
1 parent 474f918 commit f8c08db
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
namespace Icinga\Module\Monitoring\Forms\Command\Object;

use Icinga\Module\Monitoring\Command\Object\DeleteDowntimeCommand;
use Icinga\Module\Monitoring\Exception\CommandTransportException;
use Icinga\Module\Monitoring\Forms\Command\CommandForm;
use Icinga\Web\Notification;

Expand Down Expand Up @@ -75,7 +76,15 @@ public function onSuccess()
->setDowntimeName($downtime->name)
->setAuthor($this->Auth()->getUser()->getUsername())
->setIsService(isset($downtime->service_description));
$this->getTransport($this->request)->send($delDowntime);

try {
$this->getTransport($this->request)->send($delDowntime);
} catch (CommandTransportException $e) {
// Negative lookahead because there may be messages from other endpoints with different status codes
if (preg_match('/Can\'t send external Icinga command: (?!404)/', $e->getMessage())) {
throw $e;
}
}
}
$redirect = $this->getElement('redirect')->getValue();
if (! empty($redirect)) {
Expand Down

0 comments on commit f8c08db

Please sign in to comment.