[LRUG] [Chat] IronRuby

Tom Ward tom at popdog.net
Tue Jul 24 05:45:32 PDT 2007


On 24/07/07, David Salgado <david at digitalronin.com> wrote:
> Personally, no. I'm just against exceptions occurring as an integral part of
> the core of your application. Catching a save! exception is great for
> errors, but you shouldn't be throwing exceptions unless something goes
> wrong.

I agree with this.  And by something going wrong, I would mean more
than just a validation failure in a place you might expect validations
to fail.  So to me, this pattern (which I've seen in the wild) or
variations of the same would smell bad:

def create
  @person = Person.new(params[:person])
  @person.save!
  redirect_to :index
rescue
  # validation failed, go back to form
  redirect_to :new
end

If you go along with this, then the performance of begin/throw/rescue
in IronRuby shouldn't make much difference to the core performance of
your app.

Tom



More information about the Chat mailing list