diff --git a/src/Backends/Jellyfin/Action/Import.php b/src/Backends/Jellyfin/Action/Import.php index 53a13505..4b9d5cd0 100644 --- a/src/Backends/Jellyfin/Action/Import.php +++ b/src/Backends/Jellyfin/Action/Import.php @@ -139,6 +139,7 @@ class Import return []; } catch (JsonException $e) { $this->logger->error('Request for [%(backend)] libraries returned with invalid body.', [ + 'backend' => $context->backendName, 'exception' => [ 'file' => $e->getFile(), 'line' => $e->getLine(), diff --git a/src/Backends/Plex/Action/Import.php b/src/Backends/Plex/Action/Import.php index 5c297ca4..d462bc38 100644 --- a/src/Backends/Plex/Action/Import.php +++ b/src/Backends/Plex/Action/Import.php @@ -140,6 +140,7 @@ class Import return []; } catch (JsonException $e) { $this->logger->error('Request for [%(backend)] libraries returned with invalid body.', [ + 'backend' => $context->backendName, 'exception' => [ 'file' => $e->getFile(), 'line' => $e->getLine(), diff --git a/src/Commands/State/PushCommand.php b/src/Commands/State/PushCommand.php index 74f79405..f25ed7c0 100644 --- a/src/Commands/State/PushCommand.php +++ b/src/Commands/State/PushCommand.php @@ -199,6 +199,7 @@ class PushCommand extends Command 'line' => $e->getLine(), 'kind' => get_class($e), 'message' => $e->getMessage(), + 'trace' => $e->getTrace(), ], ] ); diff --git a/src/Libs/Initializer.php b/src/Libs/Initializer.php index f9a7ed58..db8e019a 100644 --- a/src/Libs/Initializer.php +++ b/src/Libs/Initializer.php @@ -157,6 +157,7 @@ final class Initializer 'file' => $e->getFile(), 'line' => $e->getLine(), 'kind' => get_class($e), + 'trace' => $e->getTrace(), ] ); $response = new Response(500); @@ -206,6 +207,7 @@ final class Initializer 'line' => $e->getLine(), 'kind' => get_class($e), 'message' => $e->getMessage(), + 'trace' => $e->getTrace(), ] ]); continue; diff --git a/src/Libs/Storage/PDO/PDOAdapter.php b/src/Libs/Storage/PDO/PDOAdapter.php index 1ec26a93..50bee045 100644 --- a/src/Libs/Storage/PDO/PDOAdapter.php +++ b/src/Libs/Storage/PDO/PDOAdapter.php @@ -95,7 +95,15 @@ final class PDOAdapter implements StorageInterface } catch (PDOException $e) { $this->stmt['insert'] = null; if (false === $this->viaTransaction && false === $this->singleTransaction) { - $this->logger->error($e->getMessage(), $entity->getAll()); + $this->logger->error($e->getMessage(), [ + 'entity' => $entity->getAll(), + 'exception' => [ + 'file' => $e->getFile(), + 'line' => $e->getLine(), + 'message' => $e->getMessage(), + 'trace' => $e->getTrace(), + ], + ]); return $entity; } throw $e; @@ -241,7 +249,15 @@ final class PDOAdapter implements StorageInterface } catch (PDOException $e) { $this->stmt['update'] = null; if (false === $this->viaTransaction && false === $this->singleTransaction) { - $this->logger->error($e->getMessage(), $entity->getAll()); + $this->logger->error($e->getMessage(), [ + 'entity' => $entity->getAll(), + 'exception' => [ + 'file' => $e->getFile(), + 'line' => $e->getLine(), + 'message' => $e->getMessage(), + 'trace' => $e->getTrace(), + ] + ]); return $entity; } throw $e; @@ -268,7 +284,15 @@ final class PDOAdapter implements StorageInterface $this->query(sprintf('DELETE FROM state WHERE %s = %d', iFace::COLUMN_ID, (int)$id)); } catch (PDOException $e) { - $this->logger->error($e->getMessage()); + $this->logger->error($e->getMessage(), [ + 'entity' => $entity->getAll(), + 'exception' => [ + 'file' => $e->getFile(), + 'line' => $e->getLine(), + 'message' => $e->getMessage(), + 'trace' => $e->getTrace(), + ], + ]); return false; } @@ -295,7 +319,15 @@ final class PDOAdapter implements StorageInterface } } catch (PDOException $e) { $actions['failed']++; - $this->logger->error($e->getMessage(), $entity->getAll()); + $this->logger->error($e->getMessage(), [ + 'entity' => $entity->getAll(), + 'exception' => [ + 'file' => $e->getFile(), + 'line' => $e->getLine(), + 'message' => $e->getMessage(), + 'trace' => $e->getTrace(), + ], + ]); } } @@ -519,7 +551,7 @@ final class PDOAdapter implements StorageInterface try { return $stmt->execute($cond); } catch (PDOException $e) { - if (false !== stripos($e->getMessage(), 'database is locked')) { + if (true === str_contains(strtolower($e->getMessage()), 'database is locked')) { if ($i >= self::LOCK_RETRY) { throw $e; } @@ -545,7 +577,7 @@ final class PDOAdapter implements StorageInterface try { return $this->pdo->query($sql); } catch (PDOException $e) { - if (false !== stripos($e->getMessage(), 'database is locked')) { + if (true === str_contains(strtolower($e->getMessage()), 'database is locked')) { if ($i >= self::LOCK_RETRY) { throw $e; }