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 ee8220e3
authored
Jul 29, 2015
by
Sean Herman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Throw the original error from authenticate
1 parent
e3b9e02c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
5 deletions
lib/sequelize.js
test/integration/sequelize.test.js
lib/sequelize.js
View file @
ee8220e
...
...
@@ -932,7 +932,7 @@ Sequelize.prototype.drop = function(options) {
*/
Sequelize
.
prototype
.
authenticate
=
function
(
options
)
{
return
this
.
query
(
'SELECT 1+1 AS result'
,
Utils
.
_
.
assign
({
raw
:
true
,
plain
:
true
},
options
)).
return
().
catch
(
function
(
err
)
{
throw
new
Error
(
err
)
;
throw
err
;
});
};
...
...
test/integration/sequelize.test.js
View file @
ee8220e
...
...
@@ -106,6 +106,18 @@ describe(Support.getTestDialectTeaser('Sequelize'), function() {
});
});
it
(
'triggers an actual RangeError or ConnectionError'
,
function
()
{
return
this
.
sequelizeWithInvalidConnection
.
authenticate
()
.
catch
(
function
(
err
)
{
expect
(
err
instanceof
RangeError
||
err
instanceof
Sequelize
.
ConnectionError
).
to
.
be
.
ok
;
});
});
it
(
'triggers the actual adapter error'
,
function
()
{
return
this
.
sequelizeWithInvalidConnection
...
...
@@ -114,10 +126,10 @@ describe(Support.getTestDialectTeaser('Sequelize'), function() {
expect
(
err
.
message
.
match
(
/connect ECONNREFUSED/
)
||
err
.
message
.
match
(
/invalid port number/
)
||
err
.
message
.
match
(
/
RangeError:
Port should be > 0 and < 65536/
)
||
err
.
message
.
match
(
/
RangeError:
port should be > 0 and < 65536/
)
||
err
.
message
.
match
(
/
RangeError:
port should be >= 0 and < 65536: 99999/
)
||
err
.
message
.
match
(
/
ConnectionError:
Login failed for user/
)
err
.
message
.
match
(
/Port should be > 0 and < 65536/
)
||
err
.
message
.
match
(
/port should be > 0 and < 65536/
)
||
err
.
message
.
match
(
/port should be >= 0 and < 65536: 99999/
)
||
err
.
message
.
match
(
/Login failed for user/
)
).
to
.
be
.
ok
;
});
});
...
...
@@ -137,6 +149,15 @@ describe(Support.getTestDialectTeaser('Sequelize'), function() {
});
});
it
(
'triggers an actual sequlize error'
,
function
()
{
return
this
.
sequelizeWithInvalidCredentials
.
authenticate
()
.
catch
(
function
(
err
)
{
expect
(
err
).
to
.
be
.
instanceof
(
Sequelize
.
Error
);
});
});
it
(
'triggers the error event when using replication'
,
function
()
{
return
new
Sequelize
(
'sequelize'
,
null
,
null
,
{
replication
:
{
...
...
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