Exception handling

355 views
Skip to first unread message

Smedrick

unread,
Feb 6, 2012, 2:52:20 PM2/6/12
to Ponyrb
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?

Ben Prew

unread,
Feb 6, 2012, 3:04:33 PM2/6/12
to pon...@googlegroups.com
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

Richard Watkins

unread,
Feb 6, 2012, 4:48:46 PM2/6/12
to pon...@googlegroups.com
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. 

Ben Prew

unread,
Feb 6, 2012, 6:10:45 PM2/6/12
to pon...@googlegroups.com
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

Ben Prew

unread,
Mar 15, 2013, 1:24:02 PM3/15/13
to pon...@googlegroups.com
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


On Thu, Mar 14, 2013 at 10:27 PM, <ankit.v...@pragtech.co.in> wrote:
> return (where mail is substituted for your actual mail call)
> means what exactly will be here.. Plz tel me the answer
> --
>
> ---
> 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.
>
>
Reply all
Reply to author
Forward
0 new messages