qiniu / ruby-sdk

Qiniu Resource (Cloud) Storage SDK for Ruby
MIT License
164 stars 138 forks source link

host_manager文件中的BucketIsMissing的错误类没有引入 #176

Closed anning0322 closed 7 years ago

anning0322 commented 7 years ago

host_manager 中的 BucketIsMissing 错误常量类没有引入,如果uploade_with_token2 rescue它时候会报出z找不到常量

错误出处:upload_with_token_2 方法

发送请求

    HTTP.api_post(url, post_data)
  rescue BucketIsMissing #<==这里
    raise 'upload_with_token_2 requires :bucket option when multi_region is enabled'
  end # upload_with_token_2

解决办法 在upload_with_token2的rescue 跑出错误类型前边加上module名

Qiniu::BucketIsMissing

或者autoload一下

class BucketIsMissing < RuntimeError; end

autoload :BucketIsMissing, 'qiniu/host_manager'

longbai commented 7 years ago

我们看下