lib/gooddata/client.rb in gooddata-0.6.0.pre7 vs lib/gooddata/client.rb in gooddata-0.6.0.pre8
- old
+ new
@@ -85,13 +85,15 @@
# * +user+ - A GoodData username
# * +password+ - A GoodData password
#
def connect(options=nil, second_options=nil, third_options={})
if options.is_a? Hash
+ fail "You have to provide login and password" if ((options[:login].nil? || options[:login].empty?) && (options[:password].nil? || options[:password].empty?))
threaded[:connection] = Connection.new(options[:login], options[:password], options)
GoodData.project = options[:project] if options[:project]
elsif options.is_a?(String) && second_options.is_a?(String)
+ fail "You have to provide login and password" if ((options.nil? || options.empty?) && (second_options.nil? || second_options.empty?))
threaded[:connection] = Connection.new(options, second_options, third_options)
end
end
@@ -134,11 +136,11 @@
fail "You have to specify a project when using with_project" if project.nil? || (project.is_a?(String) && project.empty?)
old_project = GoodData.project
begin
GoodData.use(project)
bl.call(GoodData.project)
- rescue Exception => e
- fail e
+ rescue RestClient::ResourceNotFound => e
+ fail GoodData::ProjectNotFound.new(e)
ensure
GoodData.project = old_project
end
end