mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Merge pull request #465 from sharelatex/sk-hide-email-errors
If sending email fails, return a generic error.
This commit is contained in:
commit
f53234271f
2 changed files with 6 additions and 3 deletions
|
@ -72,6 +72,7 @@ module.exports =
|
||||||
client.sendMail options, (err, res)->
|
client.sendMail options, (err, res)->
|
||||||
if err?
|
if err?
|
||||||
logger.err err:err, "error sending message"
|
logger.err err:err, "error sending message"
|
||||||
|
err = new Error('Cannot send email')
|
||||||
else
|
else
|
||||||
logger.log "Message sent to #{options.to}"
|
logger.log "Message sent to #{options.to}"
|
||||||
callback(err)
|
callback(err)
|
||||||
|
|
|
@ -51,17 +51,19 @@ describe "EmailSender", ->
|
||||||
it "should set the properties on the email to send", (done)->
|
it "should set the properties on the email to send", (done)->
|
||||||
@sesClient.sendMail.callsArgWith(1)
|
@sesClient.sendMail.callsArgWith(1)
|
||||||
|
|
||||||
@sender.sendEmail @opts, =>
|
@sender.sendEmail @opts, (err) =>
|
||||||
|
expect(err).to.not.exist
|
||||||
args = @sesClient.sendMail.args[0][0]
|
args = @sesClient.sendMail.args[0][0]
|
||||||
args.html.should.equal @opts.html
|
args.html.should.equal @opts.html
|
||||||
args.to.should.equal @opts.to
|
args.to.should.equal @opts.to
|
||||||
args.subject.should.equal @opts.subject
|
args.subject.should.equal @opts.subject
|
||||||
done()
|
done()
|
||||||
|
|
||||||
it "should return the error", (done)->
|
it "should return a non-specific error", (done)->
|
||||||
@sesClient.sendMail.callsArgWith(1, "error")
|
@sesClient.sendMail.callsArgWith(1, "error")
|
||||||
@sender.sendEmail {}, (err)=>
|
@sender.sendEmail {}, (err)=>
|
||||||
err.should.equal "error"
|
err.should.exist
|
||||||
|
err.toString().should.equal 'Error: Cannot send email'
|
||||||
done()
|
done()
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue