graphql-errors 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +21 -0
- data/README.md +16 -3
- data/lib/graphql/errors.rb +1 -1
- data/lib/graphql/errors/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: d5ee73a9e584baf90ba0f71fae3e818708232268f87eb5042e10890d3f261dc5
|
4
|
+
data.tar.gz: 7f0341ca0b3af1f912f57fae80db5a9f2023a59efc781fd6f028b9e8e973c19e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 61a1a30582caccc372d2a4aafd0c17cc81012f77d3ad147665726320cea121f457f6ff9fa5866c806940b68f922c1a3ee376777c330fa2ad817a7c31efd1df6e
|
7
|
+
data.tar.gz: e0d49d3a319fae588deb6dfb6069b34bf2d23b9b0f2c431ebe23876a346fda2fd017ff53b97f10923130c5e7397835276fbb0746cab47c8094db5c055c86eeea
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
The following are lists of the notable changes included with each release.
|
4
|
+
This is intended to help keep people informed about notable changes between
|
5
|
+
versions, as well as provide a rough history. Each item is prefixed with
|
6
|
+
one of the following labels: `Added`, `Changed`, `Deprecated`,
|
7
|
+
`Removed`, `Fixed`, `Security`. We also use [Semantic Versioning](http://semver.org)
|
8
|
+
to manage the versions of this gem so
|
9
|
+
that you can set version constraints properly.
|
10
|
+
|
11
|
+
#### [Unreleased](https://github.com/exAspArk/graphql-errors/compare/v0.2.0...HEAD)
|
12
|
+
|
13
|
+
* WIP
|
14
|
+
|
15
|
+
#### [v0.2.0](https://github.com/exAspArk/graphql-errors/compare/v0.1.0...v0.2.0) – 2018-03-15
|
16
|
+
|
17
|
+
* `Added`: `object, argument, context` to rescue_from. [#8](https://github.com/exAspArk/graphql-errors/pull/8)
|
18
|
+
|
19
|
+
#### [v0.1.0](https://github.com/exAspArk/graphql-errors/compare/b24b18c...v0.1.0) – 2017-08-29
|
20
|
+
|
21
|
+
* `Added`: initial functional version.
|
data/README.md
CHANGED
@@ -12,6 +12,14 @@ This gem provides a simple error handling for [graphql-ruby](https://github.com/
|
|
12
12
|
<img src="images/universe.png" height="41" width="153" alt="Sponsored by Universe" style="max-width:100%;">
|
13
13
|
</a>
|
14
14
|
|
15
|
+
|
16
|
+
## Highlights
|
17
|
+
|
18
|
+
* Error handling for each field.
|
19
|
+
* Logic inside the `rescue_from` block, similarly to Rails.
|
20
|
+
* Per schema configuration.
|
21
|
+
* No dependencies.
|
22
|
+
|
15
23
|
## Usage
|
16
24
|
|
17
25
|
Once you defined your GraphQL schema:
|
@@ -22,7 +30,7 @@ Schema = GraphQL::Schema.define do
|
|
22
30
|
end
|
23
31
|
```
|
24
32
|
|
25
|
-
You can add error handlers with `GraphQL::Errors`. For example:
|
33
|
+
You can add `rescue_from` error handlers with `GraphQL::Errors`. For example:
|
26
34
|
|
27
35
|
```ruby
|
28
36
|
GraphQL::Errors.configure(Schema) do
|
@@ -35,8 +43,13 @@ GraphQL::Errors.configure(Schema) do
|
|
35
43
|
end
|
36
44
|
|
37
45
|
rescue_from StandardError do |exception|
|
38
|
-
|
39
|
-
|
46
|
+
GraphQL::ExecutionError.new("Please try to execute the query for this field later")
|
47
|
+
end
|
48
|
+
|
49
|
+
rescue_from CustomError do |exception, object, arguments, context|
|
50
|
+
error = GraphQL::ExecutionError.new("Error found!")
|
51
|
+
firstError.path = context.path + ["myError"]
|
52
|
+
context.add_error(firstError)
|
40
53
|
end
|
41
54
|
end
|
42
55
|
```
|
data/lib/graphql/errors.rb
CHANGED
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.2.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: 2018-03-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: graphql
|
@@ -97,6 +97,7 @@ files:
|
|
97
97
|
- ".rspec"
|
98
98
|
- ".ruby-version"
|
99
99
|
- ".travis.yml"
|
100
|
+
- CHANGELOG.md
|
100
101
|
- CODE_OF_CONDUCT.md
|
101
102
|
- Gemfile
|
102
103
|
- LICENSE.txt
|
@@ -128,7 +129,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
128
129
|
version: '0'
|
129
130
|
requirements: []
|
130
131
|
rubyforge_project:
|
131
|
-
rubygems_version: 2.
|
132
|
+
rubygems_version: 2.7.6
|
132
133
|
signing_key:
|
133
134
|
specification_version: 4
|
134
135
|
summary: Simple error handler for graphql-ruby
|