Tagged Questions
0
votes
0answers
9 views
Rescuing Selenium WebDriver exceptions inside cucumber Around statement
I'm using the ruby selenium webdriver with cucumber to run multiple browser tests. I have several steps where exceptions could be raised, and don't want to put a begin/rescue block around every step. ...
2
votes
1answer
58 views
Can I evaluate a block against a Binding object in Ruby?
I'm trying to pass the context in which an exception was raised to an Exception subclass, in order to use this context to generate an informative error message. I recognize that I could pass ...
0
votes
1answer
86 views
how to handle mongodb's E11000 duplicate key error in ruby
Is there any good example of handling mongodb related exceptions in ruby?
In this case I have:
/home/askar/.rvm/gems/ruby-1.9.3-p429/gems/mongo-1.8.6/lib/mongo/networking.rb:89:in ...
0
votes
1answer
26 views
error management service for my Ruby on Rails project
I am looking for error management service for my Ruby on Rails project, Can any one suggest the best tool with lower price.
I have 5 Rails projects.
I found one tool http://www.batbugger.io/ is free ...
0
votes
2answers
61 views
Ruby: Rescuing the same error type twice
Is it possible to rescue the same error type more than once in ruby? I am needing to while using the Koala facebook API library like so:
begin
# Try with user provided app token
fb = ...
1
vote
2answers
75 views
Begin and Rescue block exception handling
I have little experience in rails exception handling. I have this snippet
def update
@game = Game.find(params[:id])
begin
params[:game][:tier] = eval(params[:game][:tier])
rescue
...
1
vote
2answers
87 views
Ruby custom error classes: the message attribute, and inheritance
I can't seem to find much information about custom exception classes.
What I do know
You can declare your custom error class and let it inherit from StandardError, so it can be rescued:
class ...
1
vote
1answer
36 views
Ruby: Prepend info to exception messages without touching stacktrace
I need to prepend debugging info to all exceptions that occur within a block, but I don't want to mess up the backtrace.$! doesn't seem to be allowing this in 1.9.3; raise is replacing the backtrace ...
0
votes
1answer
47 views
handle ruby process termination after clicking “X”
I know that we can handle Ctrl-C using
rescue Exception, or
rescue SystemExit, or
trap(0) or
trap("SIGTERM") or
trap("INT"),
but I want to handle the break from clicking "X" button to ...
1
vote
5answers
65 views
How to catch all exceptions as soon as they occur by just one rescue statement
I know how to catch the exceptions but what we do is to put "rescue" after a suspicious section of a code. what if you had a lot functions sending a query to mysql through mysql2 gem and you want to ...
2
votes
2answers
178 views
Ruby rack middleware to filter all the exceptions raised in the stack
Hi I just had a question on how to appropriately manage exception handling with ruby rack.
I am currently building a lightweight API with Sinatra/Rack and every route could through an exception (e.g. ...
5
votes
1answer
74 views
How does `rescue $!` work?
I know that the global variable $! holds the most recent exception object, but I am having confusion with the syntax below. Can anyone help me understand the following syntax?
rescue $!
2
votes
2answers
219 views
Can't rescue YAML.load exception
I'm trying to handle loading invalid YAML data in Ruby, but seem to be unable to rescue exceptions raised by psych.
This is some example code to demonstrate the issue I'm having:
require 'yaml'
...
-1
votes
2answers
53 views
iterate over an array and delete elements conditionally
I want to iterate over an array of URLs, and remove elements from it if there is a timeout with the HTTP request for the given URL. It has been implemented in the following way:
@urls.delete_if do ...
0
votes
2answers
243 views
unable to catch ruby exception
Having the following, long running rake batch:
class SyncStarredRepo
include Mongoid::Document
def self.update
User.all.map do |user|
if user.email != "[email protected]"
...