Skip to content

Commit c02f4f5

Browse files
committed
Exception serialization (see nextcloud/server#21875)
1 parent 69dbf0f commit c02f4f5

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

lib/BackgroundJobs/ProcessFileJob.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ protected function run($argument) : void {
9595
$this->initUserEnvironment($uid);
9696
$this->processFile($filePath);
9797
} catch (\Throwable $ex) {
98-
$this->logger->error($ex->getMessage(), [$ex]);
98+
$this->logger->error($ex->getMessage(), ['exception' => $ex]);
9999
} finally {
100100
$this->shutdownUserEnvironment();
101101
}

tests/Unit/BackgroundJobs/ProcessFileJobTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ public function testCatchesExceptionAndResetsUserEnvironment() {
150150

151151
$this->logger->expects($this->once())
152152
->method('error')
153-
->with($exception->getMessage(), [$exception]);
153+
->with($exception->getMessage(), ['exception' => $exception]);
154154

155155
// Make sure user-environment is reset after any exception
156156
// so the user should be set on beginning but should also
@@ -327,7 +327,7 @@ public function testThrowsNoUserException_OnNonExistingUser() {
327327
$this->logger->expects($this->once())
328328
->method('error')
329329
->with($this->stringContains('nonexistinguser'), $this->callback(function ($subject) {
330-
return is_array($subject) && ($subject[0] instanceof NoUserException);
330+
return is_array($subject) && ($subject['exception'] instanceof NoUserException);
331331
}));
332332

333333
$processFileJob = new ProcessFileJob(

0 commit comments

Comments
 (0)