# Try catch error

**URL:** <https://www.ruby-forum.com/t/try-catch-error/110867>\
**Category:** Rails\
**Created:** [July 31, 2007, 5:14pm UTC](https://www.ruby-forum.com/t/try-catch-error/110867 "2007-07-31T17:14:50Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![snantz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/c2a13f/32.png) [@snantz](https://www.ruby-forum.com/u/snantz)\
**Post date:** [July 31, 2007, 5:14pm UTC](https://www.ruby-forum.com/t/try-catch-error/110867/1 "2007-07-31T17:14:50Z")

</div>

I have a form that allows the user to enter membership info. If the  
membership is a good one, it is allowed, but if not a prompt incates  
that it was bad. After you click ok on that prompt, a try catch error  
appears in the div that get updated when the user enters correct info

try { alert(“Invalid Membership Number”);  
Element.update(“add\_airline\_table”, " "); } catch (e) { alert(‘RJS  
error:\n\n’ + e.toString()); alert(‘alert(“Invalid Membership  
Number”);\nElement.update(“add\_airline\_table”, " ");’); throw e }

The code is pretty straight forward:

render :update do |page|  
page.alert “Invalid Membership Number”  
end

I’m trying to figure out how to stop this behavoir. Another thing is  
that, in my form I have an :update hash which updates the div where this  
error appears. Basically, the div gets only updated when the user enters  
correct info and nothing when bad info is entered. Thanks,

~S
