Skip to content

Commit

Permalink
Use error exceptions (#202)
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Dec 2, 2023
1 parent 52907d0 commit 6c8124f
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/API/TelevisionApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -1585,6 +1585,7 @@ private function parseRequestSessionId(

/**
* @throws Exceptions\TelevisionApiCall
* @throws Exceptions\TelevisionApiError
*/
private function parseGetSpecs(
Message\RequestInterface $request,
Expand Down Expand Up @@ -1619,6 +1620,7 @@ private function parseGetSpecs(

/**
* @throws Exceptions\TelevisionApiCall
* @throws Exceptions\TelevisionApiError
*/
private function parseGetApps(
Message\RequestInterface $request,
Expand Down Expand Up @@ -1713,6 +1715,7 @@ private function parseGetApps(

/**
* @throws Exceptions\TelevisionApiCall
* @throws Exceptions\TelevisionApiError
*/
private function parseGetVectorInfo(
Message\RequestInterface $request,
Expand Down Expand Up @@ -1896,6 +1899,7 @@ private function parseGetMute(

/**
* @throws Exceptions\TelevisionApiCall
* @throws Exceptions\TelevisionApiError
*/
private function parseRequestPinCode(
Message\RequestInterface $request,
Expand Down Expand Up @@ -1931,6 +1935,7 @@ private function parseRequestPinCode(
* @param array<int> $hmacKey
*
* @throws Exceptions\TelevisionApiCall
* @throws Exceptions\TelevisionApiError
*/
private function parseAuthorizePinCode(
Message\RequestInterface $request,
Expand Down Expand Up @@ -2019,14 +2024,14 @@ private function getResponseBody(
*
* @return T
*
* @throws Exceptions\TelevisionApiCall
* @throws Exceptions\TelevisionApiError
*/
private function createEntity(string $entity, array $data): Entities\API\Entity
{
try {
return $this->entityHelper->create($entity, $data);
} catch (Exceptions\Runtime $ex) {
throw new Exceptions\TelevisionApiCall('Could not map data to entity', null, null, $ex->getCode(), $ex);
throw new Exceptions\TelevisionApiError('Could not map data to entity', $ex->getCode(), $ex);
}
}

Expand Down Expand Up @@ -2426,7 +2431,7 @@ private function createXmlRequest(
}

/**
* @throws Exceptions\TelevisionApiCall
* @throws Exceptions\TelevisionApiError
*/
private function deriveSessionKeys(): void
{
Expand Down

0 comments on commit 6c8124f

Please sign in to comment.