[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

not catching my exception

Junkone

1/16/2008 1:51:00 PM

Hello
begin
if(nil|pattern.match(details)) then
id=$1
rec=Scans.find(id)
rec.scannable=MARKTRUE
rec.save
else
badpattern=true
end
rescue RecordNotFound
badpattern=true

end

I still get the prog stopping and printing out the exception
Pl choose alert action? 3 1000
e:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/
dependencies.rb:266:in `load_missing_constant': uniniti
alized constant RecordNotFound (NameError)
from e:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/
active_support/dependencies.rb:452:in `const_missing'
from e:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/
active_support/dependencies.rb:464:in `const_missing'
from MainMenu.rb:118:in `alertsMenu'
3 Answers

yermej

1/16/2008 2:56:00 PM

0

On Jan 16, 7:50 am, Junkone <junko...@gmail.com> wrote:
> Hello
> begin
> if(nil|pattern.match(details)) then
> id=$1
> rec=Scans.find(id)
> rec.scannable=MARKTRUE
> rec.save
> else
> badpattern=true
> end
> rescue RecordNotFound
> badpattern=true
>
> end
>
> I still get the prog stopping and printing out the exception
> Pl choose alert action? 3 1000

uninitialized constant RecordNotFound (NameError)

This is telling you that RecordNotFound has not been defined. Maybe
you've forgotten to include something?

Jean-François Trân

1/16/2008 3:54:00 PM

0

2008/1/16, yermej <yermej@gmail.com>:

> > I still get the prog stopping and printing out the exception
> > Pl choose alert action? 3 1000
>
> uninitialized constant RecordNotFound (NameError)
>
> This is telling you that RecordNotFound has not been defined.
> Maybe you've forgotten to include something?

I guess Junkone is refering to ActiveRecord::RecordNotFound
exception, but he doesn't give much info.

Furthermore, if it's a ActiveRecord related problem, it should be
asked in Rails-Talk mailing list.

-- Jean-Fran=E7ois.

Junkone

1/16/2008 6:04:00 PM

0

On Jan 16, 10:54 am, Jean-François Trân <jft...@rubyfrance.org> wrote:
> 2008/1/16, yermej <yer...@gmail.com>:
>
> > > I still get the prog stopping and printing out the exception
> > > Pl choose alert action?  3 1000
>
> > uninitialized constant RecordNotFound (NameError)
>
> > This is telling you that RecordNotFound has not been defined.
> > Maybe you've forgotten to include something?
>
> I guess Junkone is refering to ActiveRecord::RecordNotFound
> exception, but he doesn't give much info.
>
> Furthermore, if it's a ActiveRecord related problem,  it should be
> asked in Rails-Talk mailing list.
>
>    -- Jean-François.yes nol

now i realise i should have used ActiveRecord::RecordNotFound
thanks