Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
public
/
sequelize
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
不要怂,就是干,撸起袖子干!
Commit 6a170cd2
authored
Feb 05, 2014
by
Sascha Gehlich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make sure that sequelize.authenticate() passes the real error instead of squashing it
1 parent
d6329d48
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
2 deletions
lib/sequelize.js
test/sequelize.test.js
lib/sequelize.js
View file @
6a170cd
...
@@ -405,7 +405,7 @@ module.exports = (function() {
...
@@ -405,7 +405,7 @@ module.exports = (function() {
.
query
(
'SELECT 1+1 AS result'
,
null
,
{
raw
:
true
,
plain
:
true
})
.
query
(
'SELECT 1+1 AS result'
,
null
,
{
raw
:
true
,
plain
:
true
})
.
complete
(
function
(
err
,
result
)
{
.
complete
(
function
(
err
,
result
)
{
if
(
!!
err
)
{
if
(
!!
err
)
{
emitter
.
emit
(
'error'
,
new
Error
(
'Invalid credentials.'
))
emitter
.
emit
(
'error'
,
new
Error
(
err
))
}
else
{
}
else
{
emitter
.
emit
(
'success'
)
emitter
.
emit
(
'success'
)
}
}
...
...
test/sequelize.test.js
View file @
6a170cd
...
@@ -59,9 +59,37 @@ describe(Support.getTestDialectTeaser("Sequelize"), function () {
...
@@ -59,9 +59,37 @@ describe(Support.getTestDialectTeaser("Sequelize"), function () {
})
})
})
})
describe
(
'with an invalid connection'
,
function
()
{
beforeEach
(
function
()
{
var
options
=
_
.
extend
({},
this
.
sequelize
.
options
,
{
port
:
"99999"
})
this
.
sequelizeWithInvalidConnection
=
new
Sequelize
(
"wat"
,
"trololo"
,
"wow"
,
options
)
})
it
(
'triggers the error event'
,
function
(
done
)
{
this
.
sequelizeWithInvalidConnection
.
authenticate
()
.
complete
(
function
(
err
,
result
)
{
expect
(
err
).
to
.
not
.
be
.
null
done
()
})
})
it
(
'triggers the actual adapter error'
,
function
(
done
)
{
this
.
sequelizeWithInvalidConnection
.
authenticate
()
.
complete
(
function
(
err
,
result
)
{
expect
(
err
.
message
).
to
.
match
(
/Failed to authenticate/
)
done
()
})
})
})
describe
(
'with invalid credentials'
,
function
()
{
describe
(
'with invalid credentials'
,
function
()
{
beforeEach
(
function
()
{
beforeEach
(
function
()
{
this
.
sequelizeWithInvalidCredentials
=
new
Sequelize
(
"
omg
"
,
"wtf"
,
"lol"
,
this
.
sequelize
.
options
)
this
.
sequelizeWithInvalidCredentials
=
new
Sequelize
(
"
localhost
"
,
"wtf"
,
"lol"
,
this
.
sequelize
.
options
)
})
})
it
(
'triggers the error event'
,
function
(
done
)
{
it
(
'triggers the error event'
,
function
(
done
)
{
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment