Confusing error message with bad credentials #12

Closed
caseysoftware opened this Issue Jan 15, 2013 · 8 comments

Projects

None yet

4 participants

@caseysoftware

I changed my SendGrid password yesterday for an unrelated reason and when one of my crons ran this morning, I received the error message below. While it mentions the authenticator, it doesn't give any indication of what the actual error was.

(Paths removed but otherwise message untouched.)

Fatal error: Uncaught exception 'Swift_TransportException' with message 'Expected response code 250 but got code "", with message ""' in /[path]/vendor/sendgrid-php/lib/swift/classes/Swift/Transport/AbstractSmtpTransport.php:422
Stack trace:
#0 /[path]/vendor/sendgrid-php/lib/swift/classes/Swift/Transport/AbstractSmtpTransport.php(306): Swift_Transport_AbstractSmtpTransport->_assertResponseCode('', Array)
#1 /[path]/vendor/sendgrid-php/lib/swift/classes/Swift/Transport/EsmtpTransport.php(224): Swift_Transport_AbstractSmtpTransport->executeCommand('RSET??', Array, Array)
#2 /[path]/vendor/sendgrid-php/lib/swift/classes/Swift/Transport/Esmtp/Auth/LoginAuthenticator.php(50): Swift_Transport_EsmtpTransport->executeCommand('RSET??', Array)
#3 /[path]/vendor/sendgrid-php/lib/swift/classes/Swift/Transport/Esmtp/AuthHandler.php(170): Swift_Transport_Esmtp_Auth_LoginAuthenticator->authenticate in /[path]/vendor/sendgrid-php/lib/swift/classes/Swift/Transport/AbstractSmtpTransport.php on line 422
@theycallmeswift
Contributor

What version of the library are you using?

@caseysoftware

I can't find a version number. :(

But I assume it's the latest because it has this commit: d292263

@martyndavies
Contributor

@caseysoftware Is still this still an issue for you?

@caseysoftware

Yes, I just set incorrect credentials and received the same message. It could be as simple as catching the error and giving a more expressive error message.

Here's a post that covers one strategy: http://stackoverflow.com/a/2146171

@theycallmeswift
Contributor

My first thought was just to wrap the underlying call to the SwiftMailer send method in a try...catch. For whatever reason, that doesn't work. May have something to do with the version of SwiftMailer we are using. Will try again once we upgrade (coming in the next few days).

@motdotla
Contributor
motdotla commented Jul 8, 2013

@caseysoftware this will be ready soon. It's part of version 1.0.3. Once I get access to push up to packagist, it will be available. Until then, you could setup your composer.json to look like:

...
"sendgrid/sendgrid": "dev-master"
...

https://packagist.org/packages/sendgrid/sendgrid

That will put you on edge, but if you can wait, just wait to version 1.0.3 is officially released.

Thanks for your help to us on all this.

@motdotla motdotla closed this Jul 8, 2013
@caseysoftware

Thank you sir and much appreciated. :)

@motdotla
Contributor
motdotla commented Jul 8, 2013

@caseysoftware that is live now as 1.0.3. By design you'll still have to catch the error, but now the error will look like this (just tested by hand as well on a separate project utilizing this library)

Uncaught exception 'SendGrid\AuthException' with message 'Bad username / password'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment