-
Notifications
You must be signed in to change notification settings - Fork 17
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
change validate connection func #11
Conversation
c284717
to
9f0adeb
Compare
res = { valid: false, error } | ||
} | ||
} | ||
return res; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i don't understand this change, looks like debug code to me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you suggested me to change the validateConnection function to return an object with valid = true/false and the error instead of throwing if the connection is not valid.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, so why do we need to extract all of the logic to try catch ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
because i want to use the translateErrorCodes
function, this function throws the error so i need to catch it..
I know it's ugly, you have better idea to return the error without throwing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so create another function like translateErrorCodes that does that without throwing
bad4592
to
10a21b6
Compare
10a21b6
to
8eeacf2
Compare
…ove the unnecessary variable.
8eeacf2
to
1050b89
Compare
validateConnection function returns object {valid: true/false, error} instead throw
adjust the tests.