Skip to content

Commit 8754dec

Browse files
committed
refactor: replace $e->getMessage() with $e in log_message()
1 parent 53460ea commit 8754dec

10 files changed

Lines changed: 11 additions & 11 deletions

File tree

system/CLI/CLI.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -673,7 +673,7 @@ public static function generateDimensions()
673673
// Then let the developer know of the error.
674674
static::$height = null;
675675
static::$width = null;
676-
log_message('error', $e->getMessage());
676+
log_message('error', $e);
677677
}
678678
}
679679

system/CLI/GeneratorTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ protected function renderTemplate(array $data = []): string
234234
try {
235235
return view(config('Generators')->views[$this->name], $data, ['debug' => false]);
236236
} catch (Throwable $e) {
237-
log_message('error', $e->getMessage());
237+
log_message('error', $e);
238238

239239
return view("CodeIgniter\\Commands\\Generators\\Views\\{$this->template}", $data, ['debug' => false]);
240240
}

system/Cache/CacheFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public static function getHandler(Cache $config, ?string $handler = null, ?strin
7373
try {
7474
$adapter->initialize();
7575
} catch (CriticalError $e) {
76-
log_message('critical', $e->getMessage() . ' Resorting to using ' . $backup . ' handler.');
76+
log_message('critical', $e . ' Resorting to using ' . $backup . ' handler.');
7777

7878
// get the next best cache handler (or dummy if the $backup also fails)
7979
$adapter = self::getHandler($config, $backup, 'dummy');

system/Cache/Handlers/FileHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ public function save(string $key, $value, int $ttl = 60)
102102

103103
// @codeCoverageIgnoreStart
104104
} catch (Throwable $e) {
105-
log_message('debug', 'Failed to set mode on cache file: ' . $e->getMessage());
105+
log_message('debug', 'Failed to set mode on cache file: ' . $e);
106106
// @codeCoverageIgnoreEnd
107107
}
108108

system/Cookie/CookieStore.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public static function fromCookieHeaders(array $headers, bool $raw = false)
4949
try {
5050
return Cookie::fromHeaderString($header, $raw);
5151
} catch (CookieException $e) {
52-
log_message('error', $e->getMessage());
52+
log_message('error', $e);
5353

5454
return false;
5555
}

system/Database/BaseConnection.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ public function initialize()
380380
$this->connID = $this->connect($this->pConnect);
381381
} catch (Throwable $e) {
382382
$connectionErrors[] = sprintf('Main connection [%s]: %s', $this->DBDriver, $e->getMessage());
383-
log_message('error', 'Error connecting to the database: ' . $e->getMessage());
383+
log_message('error', 'Error connecting to the database: ' . $e);
384384
}
385385

386386
// No connection resource? Check if there is a failover else throw an error
@@ -401,7 +401,7 @@ public function initialize()
401401
$this->connID = $this->connect($this->pConnect);
402402
} catch (Throwable $e) {
403403
$connectionErrors[] = sprintf('Failover #%d [%s]: %s', ++$index, $this->DBDriver, $e->getMessage());
404-
log_message('error', 'Error connecting to the database: ' . $e->getMessage());
404+
log_message('error', 'Error connecting to the database: ' . $e);
405405
}
406406

407407
// If a connection is made break the foreach loop

system/Database/MySQLi/Connection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ protected function execute(string $sql)
291291
try {
292292
return $this->connID->query($this->prepQuery($sql), $this->resultMode);
293293
} catch (mysqli_sql_exception $e) {
294-
log_message('error', $e->getMessage());
294+
log_message('error', $e);
295295

296296
if ($this->DBDebug) {
297297
throw $e;

system/Database/OCI8/Connection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ protected function execute(string $sql)
204204

205205
return $result;
206206
} catch (ErrorException $e) {
207-
log_message('error', $e->getMessage());
207+
log_message('error', $e);
208208

209209
if ($this->DBDebug) {
210210
throw $e;

system/Email/Email.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1654,7 +1654,7 @@ protected function spoolEmail()
16541654
$success = $this->{$method}();
16551655
} catch (ErrorException $e) {
16561656
$success = false;
1657-
log_message('error', 'Email: ' . $method . ' throwed ' . $e->getMessage());
1657+
log_message('error', 'Email: ' . $method . ' throwed ' . $e);
16581658
}
16591659

16601660
if (! $success) {

system/HTTP/ResponseTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -634,7 +634,7 @@ public function getCookie(?string $name = null, string $prefix = '')
634634

635635
return $this->cookieStore->get($name, $prefix);
636636
} catch (CookieException $e) {
637-
log_message('error', $e->getMessage());
637+
log_message('error', $e);
638638

639639
return null;
640640
}

0 commit comments

Comments
 (0)