Skip to content

Commit

Permalink
Fixing small bugs found during testing (#305)
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Aug 27, 2024
1 parent 1776ae7 commit 9e98017
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Entities/Channels/Channel.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
use function array_key_exists;
use function assert;
use function preg_match;
use function sprintf;
use function str_replace;
use function ucwords;

Expand Down Expand Up @@ -69,7 +70,9 @@ public function getServiceType(): Types\ServiceType
preg_match(HomeKit\Constants::SERVICE_IDENTIFIER, $this->getIdentifier(), $matches);

if (!array_key_exists('type', $matches)) {
throw new Exceptions\InvalidState('Device channel has invalid identifier');
throw new Exceptions\InvalidState(
sprintf('Device channel has invalid identifier: %s', $this->getIdentifier()),
);
}

$type = str_replace(' ', '', ucwords(str_replace('_', ' ', $matches['type'])));
Expand Down

0 comments on commit 9e98017

Please sign in to comment.