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 +4 -4
- data/.tool-versions +1 -0
- data/.travis.yml +2 -3
- data/CHANGELOG.md +5 -1
- data/README.md +7 -3
- data/images/hyre.png +0 -0
- data/lib/graphql/errors.rb +6 -3
- data/lib/graphql/errors/version.rb +1 -1
- metadata +5 -5
- data/images/universe.png +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7af9ccf10ee793509d178d8ed528c73dca58f3eae9d6dd8251aa0be8be486513
|
4
|
+
data.tar.gz: 78cb2259c0fc5ac371b996f3ef9b82d1e51b8d9182cabdfa4416d483ac247f23
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6901d7ac990371ba2229a4cd61cf96f5568e1f695f8939de44b69dbfc96c7806f115fdf30a2834586a7b2f9ee465c5c1b68df25dd30cbbce82966859d9511b73
|
7
|
+
data.tar.gz: f8971b07b3ea7de8215359ade64c6050931151203fdc24c7e9f18253402ff70f16538ad16be8844a256ff33d5f3bc05818884a410063406fe9857874768cfa2d
|
data/.tool-versions
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby 2.6.5
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -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.
|
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.
|
11
|
-
<img src="images/
|
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
|
data/images/hyre.png
ADDED
Binary file
|
data/lib/graphql/errors.rb
CHANGED
@@ -44,8 +44,11 @@ module GraphQL
|
|
44
44
|
raise EmptyRescueError unless block
|
45
45
|
|
46
46
|
classes.each do |klass|
|
47
|
-
|
48
|
-
|
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
|
71
|
+
return handler if klass === exception
|
69
72
|
end
|
70
73
|
|
71
74
|
nil
|
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.
|
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:
|
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/
|
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
|
-
|
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
|
data/images/universe.png
DELETED
Binary file
|