/** * Format the SQL error message. * * @param string $sql * @param array $bindings * @param \Exception $previous * * @return string */ protected function formatMessage($sql, $bindings, $previous) { return $previous->getMessage() . ' (SQL: ' . Str::replaceArray('\\?', $bindings, $sql) . ')'; }
/** * Parse the connection into an array of the name and read / write type. * * @param string $name * * @return array */ protected function parseConnectionName($name) { $name = $name ?: $this->getDefaultConnection(); return Str::endsWith($name, ['::read', '::write']) ? explode('::', $name, 2) : [$name, null]; }
/** * Determine if the given exception was caused by a lost connection. * * @param \Exception $e * * @return bool */ protected function causedByLostConnection(Exception $e) { $message = $e->getMessage(); return Str::contains($message, ['server has gone away', 'no connection to the server', 'Lost connection', 'is dead or not enabled', 'Error while sending', 'decryption failed or bad record mac', 'SSL connection has been closed unexpectedly', 'Deadlock found when trying to get lock']); }