Skip to content

Commit

Permalink
Updated the majority of emby/jellyfin log messages.
Browse files Browse the repository at this point in the history
  • Loading branch information
arabcoders committed Jun 8, 2022
1 parent 9a26333 commit 6ad04f4
Show file tree
Hide file tree
Showing 4 changed files with 1,212 additions and 999 deletions.
1 change: 1 addition & 0 deletions src/Libs/Entity/StateInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ interface StateInterface
{
public const TYPE_MOVIE = 'movie';
public const TYPE_EPISODE = 'episode';
public const TYPE_SHOW = 'show';

/**
* If you must reference field directly, use those constants.
Expand Down
44 changes: 27 additions & 17 deletions src/Libs/Servers/EmbyServer.php
Original file line number Diff line number Diff line change
Expand Up @@ -178,30 +178,40 @@ public function parseWebhook(ServerRequestInterface $request): iFace
opts: ['override' => $fields],
)->setIsTainted(isTainted: true === in_array($event, self::WEBHOOK_TAINTED_EVENTS));
} catch (Throwable $e) {
$this->logger->error(sprintf('%s: %s', self::NAME, $e->getMessage()), [
'file' => $e->getFile(),
'line' => $e->getLine(),
'kind' => get_class($e),
$this->logger->error('Unhandled exception was thrown during [%(backend)] webhook event parsing.', [
'backend' => $this->getName(),
'exception' => [
'file' => $e->getFile(),
'line' => $e->getLine(),
'kind' => get_class($e),
'message' => $e->getMessage(),
],
'context' => [
'attributes' => $request->getAttributes(),
'payload' => $request->getParsedBody(),
],
]);

throw new HttpException(
sprintf(
'%s: Unable to process item id \'%s\'.',
$this->getName(),
$id,
), 200
sprintf('%s: Failed to handle webhook payload check logs.', $this->getName()), 200
);
}

if (!$entity->hasGuids() && !$entity->hasRelativeGuid()) {
$message = sprintf('%s: No valid/supported external ids.', self::NAME);

if (empty($providersId)) {
$message .= sprintf(' Most likely unmatched %s.', $entity->type);
}

$message .= sprintf(' [%s].', arrayToString(['guids' => !empty($providersId) ? $providersId : 'None']));
$this->logger->error('Ignoring [%(backend)] [%(title)] webhook event. No valid/supported external ids.', [
'backend' => $id,
'title' => $entity->getName(),
'context' => [
'attributes' => $request->getAttributes(),
'parsed' => $entity->getAll(),
'payload' => $request->getParsedBody(),
],
]);

throw new HttpException($message, 400);
throw new HttpException(
sprintf('%s: Import ignored. No valid/supported external ids.', $this->getName()),
200
);
}

return $entity;
Expand Down
Loading

0 comments on commit 6ad04f4

Please sign in to comment.