Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
d135631f
Commit
d135631f
authored
Aug 01, 2013
by
Qiang Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Avoid logging db errors repeatedly.
parent
af6f6d15
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
12 deletions
+6
-12
Command.php
framework/yii/db/Command.php
+4
-8
Connection.php
framework/yii/db/Connection.php
+1
-3
LogPanel.php
framework/yii/debug/panels/LogPanel.php
+1
-1
No files found.
framework/yii/db/Command.php
View file @
d135631f
...
...
@@ -146,9 +146,9 @@ class Command extends \yii\base\Component
try
{
$this
->
pdoStatement
=
$this
->
db
->
pdo
->
prepare
(
$sql
);
}
catch
(
\Exception
$e
)
{
Yii
::
error
(
$e
->
getMessage
()
.
"
\n
Failed to prepare SQL:
$sql
"
,
__METHOD__
)
;
$message
=
$e
->
getMessage
()
.
"
\n
Failed to prepare SQL:
$sql
"
;
$errorInfo
=
$e
instanceof
\PDOException
?
$e
->
errorInfo
:
null
;
throw
new
Exception
(
$
e
->
getMessage
()
,
$errorInfo
,
(
int
)
$e
->
getCode
(),
$e
);
throw
new
Exception
(
$
message
,
$errorInfo
,
(
int
)
$e
->
getCode
(),
$e
);
}
}
}
...
...
@@ -293,10 +293,7 @@ class Command extends \yii\base\Component
return
$n
;
}
catch
(
\Exception
$e
)
{
Yii
::
endProfile
(
$token
,
__METHOD__
);
$message
=
$e
->
getMessage
();
Yii
::
error
(
"
$message
\n
Failed to execute SQL:
$rawSql
"
,
__METHOD__
);
$message
=
$e
->
getMessage
()
.
"
\n
The SQL being executed was:
$rawSql
"
;
$errorInfo
=
$e
instanceof
\PDOException
?
$e
->
errorInfo
:
null
;
throw
new
Exception
(
$message
,
$errorInfo
,
(
int
)
$e
->
getCode
(),
$e
);
}
...
...
@@ -430,8 +427,7 @@ class Command extends \yii\base\Component
return
$result
;
}
catch
(
\Exception
$e
)
{
Yii
::
endProfile
(
$token
,
__METHOD__
);
$message
=
$e
->
getMessage
();
Yii
::
error
(
"
$message
\n
Command::
$method
() failed:
$rawSql
"
,
__METHOD__
);
$message
=
$e
->
getMessage
()
.
"
\n
The SQL being executed was:
$rawSql
"
;
$errorInfo
=
$e
instanceof
\PDOException
?
$e
->
errorInfo
:
null
;
throw
new
Exception
(
$message
,
$errorInfo
,
(
int
)
$e
->
getCode
(),
$e
);
}
...
...
framework/yii/db/Connection.php
View file @
d135631f
...
...
@@ -307,9 +307,7 @@ class Connection extends Component
Yii
::
endProfile
(
$token
,
__METHOD__
);
}
catch
(
\PDOException
$e
)
{
Yii
::
endProfile
(
$token
,
__METHOD__
);
Yii
::
error
(
"Failed to open DB connection (
{
$this
->
dsn
}
): "
.
$e
->
getMessage
(),
__METHOD__
);
$message
=
YII_DEBUG
?
'Failed to open DB connection: '
.
$e
->
getMessage
()
:
'Failed to open DB connection.'
;
throw
new
Exception
(
$message
,
$e
->
errorInfo
,
(
int
)
$e
->
getCode
(),
$e
);
throw
new
Exception
(
$e
->
getMessage
(),
$e
->
errorInfo
,
(
int
)
$e
->
getCode
(),
$e
);
}
}
}
...
...
framework/yii/debug/panels/LogPanel.php
View file @
d135631f
...
...
@@ -55,7 +55,7 @@ EOD;
foreach
(
$this
->
data
[
'messages'
]
as
$log
)
{
list
(
$message
,
$level
,
$category
,
$time
,
$traces
)
=
$log
;
$time
=
date
(
'H:i:s.'
,
$time
)
.
sprintf
(
'%03d'
,
(
int
)((
$time
-
(
int
)
$time
)
*
1000
));
$message
=
Html
::
encode
(
$message
);
$message
=
nl2br
(
Html
::
encode
(
$message
)
);
if
(
!
empty
(
$traces
))
{
$message
.=
Html
::
ul
(
$traces
,
array
(
'class'
=>
'trace'
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment