Exception handling

Showing 1-6 of 6 messages
Exception handling Smedrick 2/6/12 11:52 AM
I'm having an issue with Pony 1.0 where it seems to fail (in an epic
fashion) when passed faulty send_to email addresses.  My app is
managing large lists of email addresses, maintained by users.  I parse
through the list and send of the email with Pony.mail inside of a
begin...rescue.  When a bad boy comes through (something like
user@gmail ...no ".com"), my whole task grinds to a halt and the rest
of the list doesn't get processed.  Am I looking for functionality
from Pony that doesn't exist?
Re: Exception handling Ben Prew 2/6/12 12:04 PM
What's the error you're receiving?  You probably want to wrap the call
to Pony in a begin/rescue block.  I'd guess it's an exception bubbling
up from Net::SMTP or Mail.

Thanks

--Ben

Re: Exception handling Smedrick 2/6/12 1:48 PM
That's part of the problem, I get no error...just a halt.  If Pony is passing off bubbled exceptions, perhaps something underlying isn't configured to be whiny...it is a production server, after all.  Thanks for the tip, I'll do some tests straight with Mail to see if it's behaving properly. 
Re: Exception handling Ben Prew 2/6/12 3:10 PM
Richard,

That sounds interesting, what does something like:

===
begin
    Pony.mail(...)
rescue error e
   warn $!
end
===
return (where mail is substituted for your actual mail call)


--Ben

Re: Exception handling ankit.v...@pragtech.co.in 3/14/13 10:27 PM
return (where mail is substituted for your actual mail call)
means what exactly will be here.. Plz tel me the answer
Re: Exception handling Ben Prew 3/15/13 10:24 AM
Ankit,

An example would be something like:

Pony.mail( to: 'b...@dole.com', from: 'bi...@dole.com', subject: 'Test
message', body: 'This is only a test')

You can see more examples on the pony page:

https://github.com/benprew/pony
--Ben

> --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "Ponyrb" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ponyrb+un...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>