Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: replace $e->getMessage() with $e in log_message() #6182

Merged
merged 2 commits into from
Jun 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion system/CLI/CLI.php
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,7 @@ public static function generateDimensions()
// Then let the developer know of the error.
static::$height = null;
static::$width = null;
log_message('error', $e->getMessage());
log_message('error', (string) $e);
}
}

Expand Down
2 changes: 1 addition & 1 deletion system/CLI/GeneratorTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ protected function renderTemplate(array $data = []): string
try {
return view(config('Generators')->views[$this->name], $data, ['debug' => false]);
} catch (Throwable $e) {
log_message('error', $e->getMessage());
log_message('error', (string) $e);

return view("CodeIgniter\\Commands\\Generators\\Views\\{$this->template}", $data, ['debug' => false]);
}
Expand Down
2 changes: 1 addition & 1 deletion system/Cache/CacheFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public static function getHandler(Cache $config, ?string $handler = null, ?strin
try {
$adapter->initialize();
} catch (CriticalError $e) {
log_message('critical', $e->getMessage() . ' Resorting to using ' . $backup . ' handler.');
log_message('critical', $e . ' Resorting to using ' . $backup . ' handler.');

// get the next best cache handler (or dummy if the $backup also fails)
$adapter = self::getHandler($config, $backup, 'dummy');
Expand Down
2 changes: 1 addition & 1 deletion system/Cache/Handlers/FileHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public function save(string $key, $value, int $ttl = 60)

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

Expand Down
2 changes: 1 addition & 1 deletion system/Cookie/CookieStore.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public static function fromCookieHeaders(array $headers, bool $raw = false)
try {
return Cookie::fromHeaderString($header, $raw);
} catch (CookieException $e) {
log_message('error', $e->getMessage());
log_message('error', (string) $e);

return false;
}
Expand Down
4 changes: 2 additions & 2 deletions system/Database/BaseConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ public function initialize()
$this->connID = $this->connect($this->pConnect);
} catch (Throwable $e) {
$connectionErrors[] = sprintf('Main connection [%s]: %s', $this->DBDriver, $e->getMessage());
log_message('error', 'Error connecting to the database: ' . $e->getMessage());
log_message('error', 'Error connecting to the database: ' . $e);
}

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

// If a connection is made break the foreach loop
Expand Down
2 changes: 1 addition & 1 deletion system/Database/MySQLi/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ protected function execute(string $sql)
try {
return $this->connID->query($this->prepQuery($sql), $this->resultMode);
} catch (mysqli_sql_exception $e) {
log_message('error', $e->getMessage());
log_message('error', (string) $e);

if ($this->DBDebug) {
throw $e;
Expand Down
2 changes: 1 addition & 1 deletion system/Database/OCI8/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ protected function execute(string $sql)

return $result;
} catch (ErrorException $e) {
log_message('error', $e->getMessage());
log_message('error', (string) $e);

if ($this->DBDebug) {
throw $e;
Expand Down
2 changes: 1 addition & 1 deletion system/Database/Postgre/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ protected function execute(string $sql)
try {
return pg_query($this->connID, $sql);
} catch (ErrorException $e) {
log_message('error', $e);
log_message('error', (string) $e);
if ($this->DBDebug) {
throw $e;
}
Expand Down
2 changes: 1 addition & 1 deletion system/Database/SQLite3/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ protected function execute(string $sql)
? $this->connID->exec($sql)
: $this->connID->query($sql);
} catch (ErrorException $e) {
log_message('error', $e);
log_message('error', (string) $e);
if ($this->DBDebug) {
throw $e;
}
Expand Down
2 changes: 1 addition & 1 deletion system/Email/Email.php
Original file line number Diff line number Diff line change
Expand Up @@ -1654,7 +1654,7 @@ protected function spoolEmail()
$success = $this->{$method}();
} catch (ErrorException $e) {
$success = false;
log_message('error', 'Email: ' . $method . ' throwed ' . $e->getMessage());
log_message('error', 'Email: ' . $method . ' throwed ' . $e);
}

if (! $success) {
Expand Down
2 changes: 1 addition & 1 deletion system/HTTP/ResponseTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,7 @@ public function getCookie(?string $name = null, string $prefix = '')

return $this->cookieStore->get($name, $prefix);
} catch (CookieException $e) {
log_message('error', $e->getMessage());
log_message('error', (string) $e);

return null;
}
Expand Down