1
[SMTPClient
    deliverMailFrom: sender
    to: recipient
    text: message
    usingServer: 'mail.google.com']
        on: Error
        do:["Transcript show:'Sumthing went wrong'"].

If SMTPClient raises an Error saying TelnetProtocolError or ConnectionTimedOut. What's the right way to just make the Transcript display my message?

Frank Shearar
  • 17,012
  • 8
  • 67
  • 94
Irfan
  • 303
  • 1
  • 8

1 Answers1

3

You can always use a parameter in the #do: block to get information about the exception:

[SMTPClient
    deliverMailFrom: sender
    to: recipient
    text: message
    usingServer: 'mail.google.com']
        on: Error
        do:[:e | Transcript show: e].

The :e parameter in the #do: block is an instance of the error that has been raised.

Damien Cassou
  • 2,555
  • 1
  • 16
  • 21