From 13e1051b877dee5becdd8e63da73924f1ec0a582 Mon Sep 17 00:00:00 2001 From: 404 Date: Mon, 3 Sep 2012 18:10:58 +0800 Subject: [PATCH] fixed rescue for ruby 1.8 --- lib/qiniu/rs/auth.rb | 8 +++++++- spec/spec_helper.rb | 4 ++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/qiniu/rs/auth.rb b/lib/qiniu/rs/auth.rb index 226f61b..6a9a924 100755 --- a/lib/qiniu/rs/auth.rb +++ b/lib/qiniu/rs/auth.rb @@ -70,7 +70,13 @@ module Qiniu else code, data = Auth.call_with_signature(url, data, 0, options) end - rescue [MissingAccessToken, MissingRefreshToken, MissingUsernameOrPassword] => e + rescue MissingAccessToken => e + Log.logger.error e + code, data = 401, {} + rescue MissingRefreshToken => e + Log.logger.error e + code, data = 401, {} + rescue MissingUsernameOrPassword => e Log.logger.error e code, data = 401, {} end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 1313d43..d886e24 100755 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -6,8 +6,8 @@ require 'rspec' RSpec.configure do |config| config.before :all do - Qiniu::RS.establish_connection! :access_key => "bE21M6FW9V7zAFrBY5psgKOKJQLiBj12qMWTpc57", - :secret_key => "uMo7Nyq_eDK_CuQ8_FYCxoTHQZqjiaPh-cbiKO7L", + Qiniu::RS.establish_connection! :access_key => "dFX_wMGVrRzwdWaraW-Qe5ZCDT-kcSmIAGKQOkXh", + :secret_key => "VllxxDfkn_h2ZIqeKYTnHJiN4LVODfDBlJHy_KsW", :auth_url => "http://m1.qbox.me:13001/oauth2/token", :rs_host => "http://m1.qbox.me:13003", :io_host => "http://m1.qbox.me:13004",