Improved logging when encountering unexpected content type. Update #239

This commit is contained in:
abdulmohsen
2022-09-06 17:32:01 +03:00
parent 494556b9e3
commit c44fe85abc
11 changed files with 19 additions and 19 deletions

View File

@@ -137,7 +137,7 @@ final class ParseWebhook
)
),
default => throw new InvalidArgumentException(
r('Invalid Content type [{type}] was given.', [
r('Unexpected Content type [{type}] was received.', [
'type' => $type
])
),

View File

@@ -35,7 +35,7 @@ class Backup extends Import
try {
if ($context->trace) {
$this->logger->debug('Processing [%(backend)] %(item.type) payload.', [
$this->logger->debug('Processing [%(backend)] payload.', [
'backend' => $context->backendName,
...$logContext,
'payload' => $item,
@@ -60,7 +60,7 @@ class Backup extends Import
)
),
default => throw new InvalidArgumentException(
r('Invalid Content type [{type}] was given.', [
r('Unexpected Content type [{type}] was received.', [
'type' => $type
])
),

View File

@@ -35,13 +35,13 @@ class Export extends Import
try {
if ($context->trace) {
$this->logger->debug('Processing [%(backend)] %(item.type) payload.', [
$this->logger->debug('Processing [%(backend)] payload.', [
'backend' => $context->backendName,
...$logContext,
'body' => $item,
]);
}
$queue = ag($opts, 'queue', fn() => Container::get(QueueRequests::class));
$after = ag($opts, 'after', null);
@@ -64,7 +64,7 @@ class Export extends Import
)
),
default => throw new InvalidArgumentException(
r('Invalid Content type [{type}] was given.', [
r('Unexpected Content type [{type}] was received.', [
'type' => $type
])
),

View File

@@ -707,7 +707,7 @@ class Import
try {
if ($context->trace) {
$this->logger->debug('Processing [%(backend)] %(item.type) payload.', [
$this->logger->debug('Processing [%(backend)] payload.', [
'backend' => $context->backendName,
...$logContext,
'body' => $item
@@ -734,7 +734,7 @@ class Import
)
),
default => throw new InvalidArgumentException(
r('Invalid Content type [{type}] was given.', [
r('Unexpected Content type [{type}] was received.', [
'type' => $type
])
),

View File

@@ -115,7 +115,7 @@ final class ParseWebhook
)
),
default => throw new InvalidArgumentException(
r('Invalid Content type [{type}] was given.', [
r('Unexpected Content type [{type}] was received.', [
'type' => $type
])
),

View File

@@ -62,7 +62,7 @@ trait JellyfinActionTrait
str_pad((string)ag($item, 'IndexNumber', 0), 3, '0', STR_PAD_LEFT),
),
default => throw new InvalidArgumentException(
r('Invalid Content type [{type}] was given.', [
r('Unexpected Content type [{type}] was received.', [
'type' => $type
])
),

View File

@@ -35,7 +35,7 @@ final class Backup extends Import
try {
if ($context->trace) {
$this->logger->debug('Processing [%(backend)] %(item.type) payload.', [
$this->logger->debug('Processing [%(backend)] payload.', [
'backend' => $context->backendName,
...$logContext,
'payload' => $item,
@@ -63,7 +63,7 @@ final class Backup extends Import
str_pad((string)ag($item, 'index', 0), 3, '0', STR_PAD_LEFT),
),
default => throw new InvalidArgumentException(
r('Invalid Content type [{type}] was given.', [
r('Unexpected Content type [{type}] was received.', [
'type' => $type
])
),

View File

@@ -40,13 +40,13 @@ final class Export extends Import
try {
if ($context->trace) {
$this->logger->debug('Processing [%(backend)] %(item.type) payload.', [
$this->logger->debug('Processing [%(backend)] payload.', [
'backend' => $context->backendName,
...$logContext,
'body' => $item,
]);
}
Message::increment("{$context->backendName}.{$library}.total");
Message::increment("{$context->backendName}.{$mappedType}.total");
@@ -70,7 +70,7 @@ final class Export extends Import
str_pad((string)ag($item, 'index', 0), 3, '0', STR_PAD_LEFT),
),
default => throw new InvalidArgumentException(
r('Invalid Content type [{type}] was given.', [
r('Unexpected Content type [{type}] was received.', [
'type' => $type
])
),

View File

@@ -718,7 +718,7 @@ class Import
try {
if ($context->trace) {
$this->logger->debug('Processing [%(backend)] %(item.type) [%(item.title)] payload.', [
$this->logger->debug('Processing [%(backend)] payload.', [
'backend' => $context->backendName,
...$logContext,
'body' => $item,
@@ -748,7 +748,7 @@ class Import
str_pad((string)ag($item, 'index', 0), 3, '0', STR_PAD_LEFT),
),
default => throw new InvalidArgumentException(
r('Invalid Content type [{type}] was given.', [
r('Unexpected Content type [{type}] was received.', [
'type' => $type
])
),

View File

@@ -134,7 +134,7 @@ final class ParseWebhook
str_pad((string)ag($item, 'index', 0), 3, '0', STR_PAD_LEFT),
),
default => throw new InvalidArgumentException(
r('Invalid Content type [{type}] was given.', [
r('Unexpected Content type [{type}] was received.', [
'type' => $type
])
),

View File

@@ -80,7 +80,7 @@ trait PlexActionTrait
str_pad((string)ag($item, 'index', 0), 3, '0', STR_PAD_LEFT),
),
default => throw new InvalidArgumentException(
r('Invalid Content type [{type}] was given.', [
r('Unexpected Content type [{type}] was received.', [
'type' => $type
])
),