mostafah / mandrill

A small Go package for sending email through Mandrill’s API [No longer maintained]
http://godoc.org/github.com/mostafah/mandrill
17 stars 14 forks source link

mandrill.Ping does not error on invalid API keys #8

Closed BastiPaeltz closed 9 years ago

BastiPaeltz commented 9 years ago

Hey,

package main
import  "github.com/mostafah/mandrill"
import  "fmt" 

func main() {
    mandrill.Key = ""
    err := mandrill.Ping()
    if err != nil {
        fmt.Println("Mandrill credentials not valid.")
    } else {
        fmt.Println("Everything ok.")
    }
}

always yields "Everything ok." for me. This happens with all kind of random text. I'm on OS X (if that helps you).

Keep up the work, I like your mandrill package for its simplicity.

On a side node, the Message.Send() method doesn't error out as well for me when sending with an invalid key. Should I open a seperate issue for that?

mostafah commented 9 years ago

You’re right. There was no proper error handling code at all. Not sure why and not sure how it worked until now.

Anyways, I added and tested error handling. It would be great if you could test it too.

FYI, Send, Ping and other request functions use the same code for sending requests and handling responses, so there was no need for another issue. All should be fixed now.

PS: Thanks for the support.