multiconnect 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 32408fb8e025155e516692a99ccff5893b708890
4
- data.tar.gz: e260d79368321a0b4717a95f3150850b6ed3e399
3
+ metadata.gz: a1e5808b71957ab6a552635704ed899384eb7893
4
+ data.tar.gz: 0a4d19c0b30e97fa4c61612b190c9c1219aa2e8d
5
5
  SHA512:
6
- metadata.gz: d4017d97ce90a4655fa4fe73d209a52e5cd887c0292cd51c4450a423e77790f61cdb6b9c930e5c9ed7112a8b4d6037f913bcd7bb520b611ed0726765b4ba2645
7
- data.tar.gz: 29e933c5491f36995aa66f20da1853ba4bcfe1f54cac29829f5ee1cbdfc52048e206df73ae54020347682dd22b2d78a0057552233138221c13b5172e05d8f5db
6
+ metadata.gz: c6a55e27bb7a078c0263da226ba33669a6f1e126427ff608316cceb9d8952b6fed5fb51ea5cc133b45bec9594c2a20589244499f48777a5275b08814abd0cbe8
7
+ data.tar.gz: fe2867a1fea129ea979783116fead2c1a940e82288e74945962ff8d221e4e64929ece06dff302daab9096939de761507864a73943d9a9f23e50271f25e4820d1
@@ -15,12 +15,13 @@ module Multiconnect
15
15
  self._connections = [connection_class.new(options)] + _connections
16
16
  end
17
17
 
18
- def request(action, *args)
18
+ def request(action, *args, &default)
19
19
  self._connections.each do |connection|
20
20
  result = connection.execute(action, *args)
21
21
  return result if result.success?
22
22
  end
23
- raise "Multiconnect Error: #{self} has failed to request #{action}"
23
+
24
+ raise Multiconnect::Error::UnsuccessfulRequestError.new( class: self, action: action )
24
25
  end
25
26
  end
26
27
  end
@@ -0,0 +1,14 @@
1
+ module Multiconnect
2
+ module Error
3
+ class UnsuccessfulRequestError < StandardError
4
+ def initialize(opts = {})
5
+ @class = opts.fetch :class, nil
6
+ @action = opts.fetch :action, nil
7
+ end
8
+
9
+ def message
10
+ "#{@class}: Failed to request #{@action}"
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,5 @@
1
+ module Multiconnect
2
+ module Error
3
+ autoload :UnsuccessfulRequestError, 'multiconnect/error/unsuccessful_request_error'
4
+ end
5
+ end
@@ -1,3 +1,3 @@
1
1
  module Multiconnect
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
data/lib/multiconnect.rb CHANGED
@@ -6,4 +6,5 @@ require 'active_support/core_ext/class/attribute'
6
6
  module Multiconnect
7
7
  autoload :Connection, 'multiconnect/connection'
8
8
  autoload :Connectable, 'multiconnect/connectable'
9
+ autoload :Error, 'multiconnect/error'
9
10
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: multiconnect
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Greg Orlov
@@ -115,6 +115,8 @@ files:
115
115
  - lib/multiconnect/connection.rb
116
116
  - lib/multiconnect/connection/base.rb
117
117
  - lib/multiconnect/connection/result.rb
118
+ - lib/multiconnect/error.rb
119
+ - lib/multiconnect/error/unsuccessful_request_error.rb
118
120
  - lib/multiconnect/version.rb
119
121
  - multiconnect.gemspec
120
122
  homepage: https://github.com/gaorlov/multiconnect