Capturing specific Tiny_TDS exceptions

22 views
Skip to first unread message

gavin....@randomstorm.com

unread,
Mar 11, 2016, 10:13:16 PM3/11/16
to Rails SQLServer Adapter
Hi Guys, bit of a noddy question so apologies in advance. I'm trying to use Ruby's 'Begin' and 'Rescue' to capture a Tiny_TDS excpetion.

masterdbs.each do |mds|
begin
    result = client.execute("SELECT * from etc...")
    rescue
        puts "Issues connection to database."
        masterdbs.delete(mds)
        puts mds.to_s + " Removed..."
    end
end

When running the script I get a 'database restricted' for a specific database Tiny_TDS exception, which is as expected. I've purposefully restricted access to one specific database. I'd like to capture this exception, run the rescue code and move on. However, the program aborts. Am I missing something obvious?

Really appreciate your help!


This email is sent for and on behalf of Randomstorm Limited (Registered in England CRN: 6229788). Registered Office: Tuscany House, White Hart Ln, Basingstoke RG21 4AF. Accumuli Security Limited is part of NCC Group.  This email may be confidential and/or legally privileged.

Reply all
Reply to author
Forward
0 new messages