graphlient 0.3.6 → 0.3.7

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
  SHA256:
3
- metadata.gz: 360f0f96c897fae58c76624fa317385c14270444a827aa802efd95f71e46ac19
4
- data.tar.gz: fd335527ff368f734cdd906ec31a7f985fffd19b51709bdfb04c33c31e75e457
3
+ metadata.gz: ab92f3273bda224b78e022567186f00e9865d746ecb9de61d6ae392e480bc67d
4
+ data.tar.gz: 4e56127d81400beb61d1b9f502b63b3a712aa976d723dba524cbb6e579a7711b
5
5
  SHA512:
6
- metadata.gz: 77896f951d3bfad43bf77f9ce54885070ac69a6418d6d64617a7034e45d89b0e1e1399b0b4dec7f1abec43e0ee044a271e6cf68c48b0c7e8047c974ee0e3298d
7
- data.tar.gz: a4755beb10938c1e779bade046eea42ecd4035c032376dc7c0d492d8a7a35919b4fef018a0250df7f3793be4a343d20038ddf3aeca91a8e273a78c985811a726
6
+ metadata.gz: 0480cf615f51cd10d7c74efe03b0a291870027373cd9b4d5d3ee55b778ec4494379177823e1864f7d5c77da7c71eaead5a9870127a0976c9ba5ff0e84bbe9877
7
+ data.tar.gz: 73202625813b08c871393e7656412a2439caf4454e8d021c00fcd24e06cca47328bee530571e013e0e69fba217cbc284fa187ae0661f3e495eeb65e14995f6b4
@@ -1,6 +1,9 @@
1
- ### 0.3.7 (Next)
1
+ ### 0.3.8 (Next)
2
2
  * Your contribution here.
3
3
 
4
+ ### 0.3.7 (14/11/2019)
5
+ * [#68](https://github.com/ashkan18/graphlient/pull/68): Add `Graphlient::Errors::ConnectionFailedError` - [@neroleung](https://github.com/neroleung).
6
+
4
7
  ### 0.3.6 (07/23/2019)
5
8
 
6
9
  * [#63](https://github.com/ashkan18/graphlient/pull/63): Remove unused method for attribute with typo - [@ashkan18](https://github.com/ashkan18).
data/Gemfile CHANGED
@@ -4,6 +4,10 @@ gemspec
4
4
 
5
5
  gem 'rake'
6
6
 
7
+ group :development, :test do
8
+ gem 'activesupport', '< 6'
9
+ end
10
+
7
11
  group :development do
8
12
  gem 'byebug', platform: :ruby
9
13
  gem 'danger-changelog', '~> 0.2.1'
data/README.md CHANGED
@@ -126,6 +126,7 @@ Unlike graphql-client, Graphlient will always raise an exception unless the quer
126
126
  * [Graphlient::Errors::ServerError](lib/graphlient/errors/server_error.rb): all transport errors raised by HTTP Adapters. You can access `inner_exception`, `status_code` and `response` on these errors to get more details on what went wrong
127
127
  * [Graphlient::Errors::FaradayServerError](lib/graphlient/errors/faraday_server_error.rb): this inherits from `ServerError` ☝️, we recommend using `ServerError` to rescue these
128
128
  * [Graphlient::Errors::HttpServerError](lib/graphlient/errors/http_server_error.rb): this inherits from `ServerError` ☝️, we recommend using `ServerError` to rescue these
129
+ * [Graphlient::Errors::ConnectionFailedError](lib/graphlient/errors/connection_failed_error.rb): this inherits from `ServerError` ☝️, we recommend using `ServerError` to rescue these
129
130
 
130
131
 
131
132
  All errors inherit from `Graphlient::Errors::Error` if you need to handle them in bulk.
@@ -0,0 +1,12 @@
1
+ Upgrading Graphlient
2
+ ===========================
3
+
4
+ ### Upgrading to >= 0.3.7
5
+
6
+ #### Changes in error handling of connection refused error
7
+
8
+ Prior to 0.3.7, Graphlient would return `NoMethodError: undefined method []' for nil:NilClass` error if connection is
9
+ refused/failed when connecting to a remote host. After 0.3.7, Graphlient will return a new
10
+ `Graphlient::Errors::ConnectionFailedError` instead.
11
+
12
+ See [#68](https://github.com/ashkan18/graphlient/pull/68) for more information.
@@ -15,6 +15,8 @@ module Graphlient
15
15
  }.to_json
16
16
  end
17
17
  response.body
18
+ rescue Faraday::ConnectionFailed => e
19
+ raise Graphlient::Errors::ConnectionFailedError, e
18
20
  rescue Faraday::ClientError => e
19
21
  raise Graphlient::Errors::FaradayServerError, e
20
22
  end
@@ -5,3 +5,4 @@ require_relative 'errors/graphql_error'
5
5
  require_relative 'errors/execution_error'
6
6
  require_relative 'errors/faraday_server_error'
7
7
  require_relative 'errors/http_server_error'
8
+ require_relative 'errors/connection_failed_error'
@@ -0,0 +1,6 @@
1
+ module Graphlient
2
+ module Errors
3
+ class ConnectionFailedError < ServerError
4
+ end
5
+ end
6
+ end
@@ -1,3 +1,3 @@
1
1
  module Graphlient
2
- VERSION = '0.3.6'.freeze
2
+ VERSION = '0.3.7'.freeze
3
3
  end
@@ -57,4 +57,25 @@ describe Graphlient::Adapters::HTTP::FaradayAdapter do
57
57
  expect(client.schema).to be_a Graphlient::Schema
58
58
  end
59
59
  end
60
+
61
+ context 'Failed to open TCP connection error' do
62
+ let(:url) { 'http://example.com/graphql' }
63
+ let(:client) { Graphlient::Client.new(url) }
64
+ let(:error_message) do
65
+ 'Failed to open TCP connection to localhost:3000 (Connection refused - connect(2) for "localhost" port 3000)'
66
+ end
67
+
68
+ before do
69
+ wrapped_error = Errno::ECONNREFUSED.new(error_message)
70
+ error = Faraday::ConnectionFailed.new(wrapped_error)
71
+
72
+ stub_request(:post, url).to_raise(error)
73
+ end
74
+
75
+ specify do
76
+ expected_error_message = "Connection refused - #{error_message}"
77
+
78
+ expect { client.schema }.to raise_error(Graphlient::Errors::ConnectionFailedError, expected_error_message)
79
+ end
80
+ end
60
81
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: graphlient
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.6
4
+ version: 0.3.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ashkan Nasseri
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-07-23 00:00:00.000000000 Z
11
+ date: 2019-11-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -72,6 +72,7 @@ files:
72
72
  - README.md
73
73
  - RELEASING.md
74
74
  - Rakefile
75
+ - UPGRADING.md
75
76
  - graphlient.gemspec
76
77
  - lib/graphlient.rb
77
78
  - lib/graphlient/adapters.rb
@@ -82,6 +83,7 @@ files:
82
83
  - lib/graphlient/client.rb
83
84
  - lib/graphlient/errors.rb
84
85
  - lib/graphlient/errors/client_error.rb
86
+ - lib/graphlient/errors/connection_failed_error.rb
85
87
  - lib/graphlient/errors/error.rb
86
88
  - lib/graphlient/errors/execution_error.rb
87
89
  - lib/graphlient/errors/faraday_server_error.rb
@@ -135,8 +137,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
135
137
  - !ruby/object:Gem::Version
136
138
  version: 1.3.6
137
139
  requirements: []
138
- rubyforge_project:
139
- rubygems_version: 2.7.8
140
+ rubygems_version: 3.0.6
140
141
  signing_key:
141
142
  specification_version: 4
142
143
  summary: A friendlier Ruby client for consuming GraphQL-based APIs.