rescue Questions
2
Solved
Consider this begin-rescue-ensure block:
attempts=0
begin
make_service_call()
rescue Exception
retry unless attempts>2
exit -1
ensure
attemps += 1
end
If you run that code as it is, it ra...
1
Solved
In ruby,
begin
# ...
rescue
# ...
end
won't catch exceptions that aren't subclasses of StandardError. In C,
rb_rescue(x, Qnil, y, Qnil);
VALUE x(void) { /* ... */ return Qnil; }
VALUE y(void...
Interpret asked 9/7, 2010 at 21:48
2
Solved
I'm using some ruby code wrapped in a begin - rescue block but somehow it manages to still crash.
the block of code looks like this:
# Retrieve messages from server
def get_messages
@connection...
Talented asked 2/7, 2010 at 18:18
5
Solved
I have a number of controllers in my Ruby on Rails apps with a rescue handler at the end of the action that basically catches any unhandled errors and returns some kind of "user friendly" error. Ho...
Biogenesis asked 7/5, 2009 at 5:56
4
Solved
When writing the "create" method for an object in a Ruby on Rails app, I have used two methods. I would like to use one method for the sake of cleaner and more consistent code. I will list the two ...
Claudication asked 7/4, 2009 at 14:50
2
Solved
I'm trying to figure out how to rescue syntax errors that come up when eval()ing code in Ruby 1.8.6.
I would expect the following Ruby code:
#!/usr/bin/ruby
good_str = "(1+1)"
bad_str = "(1+1" #...
© 2022 - 2024 — McMap. All rights reserved.