mirror of
https://github.com/samsonjs/retrogit.git
synced 2026-04-27 15:07:43 +00:00
Email me for digest send errors.
This commit is contained in:
parent
e72f87d801
commit
f462e1917a
1 changed files with 16 additions and 0 deletions
|
|
@ -248,6 +248,9 @@ var sendDigestForAccountFunc = delay.Func(
|
||||||
sent, err := sendDigestForAccount(account, c)
|
sent, err := sendDigestForAccount(account, c)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.Errorf(" Error: %s", err.Error())
|
c.Errorf(" Error: %s", err.Error())
|
||||||
|
if !appengine.IsDevAppServer() {
|
||||||
|
sendDigestErrorMail(err, c, githubUserId)
|
||||||
|
}
|
||||||
} else if sent {
|
} else if sent {
|
||||||
c.Infof(" Sent!")
|
c.Infof(" Sent!")
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -256,6 +259,19 @@ var sendDigestForAccountFunc = delay.Func(
|
||||||
return err
|
return err
|
||||||
})
|
})
|
||||||
|
|
||||||
|
func sendDigestErrorMail(e error, c appengine.Context, gitHubUserId int) {
|
||||||
|
errorMessage := &mail.Message{
|
||||||
|
Sender: "RetroGit Admin <digests@retrogit.com>",
|
||||||
|
To: []string{"mihai.parparita@gmail.com"},
|
||||||
|
Subject: fmt.Sprintf("RetroGit Digest Send Error for %d", gitHubUserId),
|
||||||
|
Body: fmt.Sprintf("Error: %s", e),
|
||||||
|
}
|
||||||
|
err := mail.Send(c, errorMessage)
|
||||||
|
if err != nil {
|
||||||
|
c.Errorf("Error %s sending error email.", err.Error())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func sendDigestForAccount(account *Account, c appengine.Context) (bool, error) {
|
func sendDigestForAccount(account *Account, c appengine.Context) (bool, error) {
|
||||||
oauthTransport := githubOAuthTransport(c)
|
oauthTransport := githubOAuthTransport(c)
|
||||||
oauthTransport.Token = &account.OAuthToken
|
oauthTransport.Token = &account.OAuthToken
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue