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

feat(SQLSRV): Added more detailed MSSQL error message to CI log #9338

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
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
9 changes: 8 additions & 1 deletion system/Database/SQLSRV/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,14 @@
if ($stmt === false) {
$error = $this->error();

log_message('error', $error['message']);
$traceback = debug_backtrace();
$error_msg_traceback = "[SQL]: \n$sql \n[END OF SQL] \n";
$spaces = "--";
foreach($traceback as $e) {
$error_msg_traceback .= $spaces. " in ".(isset($e['file']) ? $e['file'] : 'unknown file')." -> ".(isset($e['function']) ? $e['function'] : 'unknow function')." on line ".(isset($e['line']) ? $e['line'] : "-")."\n";

Check failure on line 489 in system/Database/SQLSRV/Connection.php

View workflow job for this annotation

GitHub Actions / PHP Static Analysis

Offset 'function' on array{function: string, line?: int, file?: string, class?: class-string, type?: '->'|'::', args?: array<mixed>, object?: object} in isset() always exists and is not nullable.
$spaces .= "--";
}
log_message('error', $error['message']."\n".$error_msg_traceback);

if ($this->DBDebug) {
throw new DatabaseException($error['message']);
Expand Down
Loading