graphql-errors 0.3.0 → 0.4.0

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: dab4208b219514517e1f78887dfe928b89f0151b0f44afeea8ecae88e61f61f4
4
- data.tar.gz: deea1e3419629c3238b31fe286c67dd84002c1029efd2eb3ff7f2b2208956d28
3
+ metadata.gz: 7af9ccf10ee793509d178d8ed528c73dca58f3eae9d6dd8251aa0be8be486513
4
+ data.tar.gz: 78cb2259c0fc5ac371b996f3ef9b82d1e51b8d9182cabdfa4416d483ac247f23
5
5
  SHA512:
6
- metadata.gz: f219b4cac2aab9ab621e4c84543048a50e494109dc7dcb13067d1eb45f3086110db6fa97962c09da5d53776be4f6e37eb7407cc9f915838bcbad7fe8f9ad9ee4
7
- data.tar.gz: a4f1e762e57d2043aa139730487376fdb6938b246522a407162188858df03926982a7bcc937369386691605137873a9cad46a3e0b66b7b8a6068fbde9b019b2b
6
+ metadata.gz: 6901d7ac990371ba2229a4cd61cf96f5568e1f695f8939de44b69dbfc96c7806f115fdf30a2834586a7b2f9ee465c5c1b68df25dd30cbbce82966859d9511b73
7
+ data.tar.gz: f8971b07b3ea7de8215359ade64c6050931151203fdc24c7e9f18253402ff70f16538ad16be8844a256ff33d5f3bc05818884a410063406fe9857874768cfa2d
@@ -0,0 +1 @@
1
+ ruby 2.6.5
@@ -1,10 +1,9 @@
1
- sudo: false
2
1
  language: ruby
3
2
  rvm:
4
- - 2.3.4
3
+ - 2.3.8
5
4
  env:
6
5
  - COVERALLS_RUN_LOCALLY=true
7
- before_install: gem install bundler -v 1.15.3
6
+ before_install: gem install bundler -v '< 2'
8
7
  matrix:
9
8
  include:
10
9
  - gemfile: graphql-1.7.gemfile
@@ -8,10 +8,14 @@ one of the following labels: `Added`, `Changed`, `Deprecated`,
8
8
  to manage the versions of this gem so
9
9
  that you can set version constraints properly.
10
10
 
11
- #### [Unreleased](https://github.com/exAspArk/graphql-errors/compare/v0.3.0...HEAD)
11
+ #### [Unreleased](https://github.com/exAspArk/graphql-errors/compare/v0.4.0...HEAD)
12
12
 
13
13
  * WIP
14
14
 
15
+ #### [v0.4.0](https://github.com/exAspArk/graphql-errors/compare/v0.3.0...v0.4.0) – 2019-11-12
16
+
17
+ * `Added`: handle `rescue_from` Module arguments. [#19](https://github.com/exAspArk/graphql-errors/pull/19)
18
+
15
19
  #### [v0.3.0](https://github.com/exAspArk/graphql-errors/compare/v0.2.0...v0.3.0) – 2018-12-17
16
20
 
17
21
  * `Added`: handle errors from lazy resolvers. [#14](https://github.com/exAspArk/graphql-errors/pull/14)
data/README.md CHANGED
@@ -7,11 +7,10 @@
7
7
 
8
8
  This gem provides a simple error handling for [graphql-ruby](https://github.com/rmosolgo/graphql-ruby).
9
9
 
10
- <a href="https://www.universe.com/" target="_blank" rel="noopener noreferrer">
11
- <img src="images/universe.png" height="41" width="153" alt="Sponsored by Universe" style="max-width:100%;">
10
+ <a href="https://www.hyrestaff.com/" target="_blank" rel="noopener noreferrer">
11
+ <img src="images/hyre.png" height="39" width="137" alt="Sponsored by Hyre" style="max-width:100%;">
12
12
  </a>
13
13
 
14
-
15
14
  ## Highlights
16
15
 
17
16
  * Error handling for each field.
@@ -42,6 +41,11 @@ GraphQL::Errors.configure(Schema) do
42
41
  GraphQL::ExecutionError.new(exception.record.errors.full_messages.join("\n"))
43
42
  end
44
43
 
44
+ # uses Module to handle several similar errors with single rescue_from
45
+ rescue_from MyNetworkErrors do |_|
46
+ GraphQL::ExecutionError.new("Don't mind, just retry the mutation")
47
+ end
48
+
45
49
  rescue_from StandardError do |exception|
46
50
  GraphQL::ExecutionError.new("Please try to execute the query for this field later")
47
51
  end
Binary file
@@ -44,8 +44,11 @@ module GraphQL
44
44
  raise EmptyRescueError unless block
45
45
 
46
46
  classes.each do |klass|
47
- raise NotRescuableError.new(klass.inspect) unless klass.is_a?(Class)
48
- @handler_by_class[klass] ||= block
47
+ if klass.is_a?(Module) && klass.respond_to?(:===)
48
+ @handler_by_class[klass] ||= block
49
+ else
50
+ raise NotRescuableError.new(klass.inspect)
51
+ end
49
52
  end
50
53
  end
51
54
 
@@ -65,7 +68,7 @@ module GraphQL
65
68
 
66
69
  def find_handler(exception)
67
70
  @handler_by_class.each do |klass, handler|
68
- return handler if exception.is_a?(klass)
71
+ return handler if klass === exception
69
72
  end
70
73
 
71
74
  nil
@@ -2,6 +2,6 @@
2
2
 
3
3
  module GraphQL
4
4
  class Errors
5
- VERSION = "0.3.0"
5
+ VERSION = "0.4.0"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: graphql-errors
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - exAspArk
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-12-17 00:00:00.000000000 Z
11
+ date: 2019-11-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: graphql
@@ -96,6 +96,7 @@ files:
96
96
  - ".gitignore"
97
97
  - ".rspec"
98
98
  - ".ruby-version"
99
+ - ".tool-versions"
99
100
  - ".travis.yml"
100
101
  - CHANGELOG.md
101
102
  - CODE_OF_CONDUCT.md
@@ -108,7 +109,7 @@ files:
108
109
  - graphql-1.7.gemfile
109
110
  - graphql-1.8.gemfile
110
111
  - graphql-errors.gemspec
111
- - images/universe.png
112
+ - images/hyre.png
112
113
  - lib/graphql/errors.rb
113
114
  - lib/graphql/errors/version.rb
114
115
  homepage: https://github.com/exAspArk/graphql-errors
@@ -130,8 +131,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
130
131
  - !ruby/object:Gem::Version
131
132
  version: '0'
132
133
  requirements: []
133
- rubyforge_project:
134
- rubygems_version: 2.7.6
134
+ rubygems_version: 3.0.3
135
135
  signing_key:
136
136
  specification_version: 4
137
137
  summary: Simple error handler for graphql-ruby
Binary file