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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 6103efb8c5201ab2ffe2ed48c1805eca42e5e4b7
4
- data.tar.gz: 824b988cb73edf909c79a5cce6fd3d816cc31f3e
2
+ SHA256:
3
+ metadata.gz: d5ee73a9e584baf90ba0f71fae3e818708232268f87eb5042e10890d3f261dc5
4
+ data.tar.gz: 7f0341ca0b3af1f912f57fae80db5a9f2023a59efc781fd6f028b9e8e973c19e
5
5
  SHA512:
6
- metadata.gz: 4d9d045d83b52cbbb714437517c65e36aee3606c4522b258b6496ff65c2dea5103d7ff9e0ca22fe5eeafd369c17506469bdc101164d9ca96ae7c1408a34831bd
7
- data.tar.gz: b7fca04107e6402e04136a1dcd9bf22d5b0c53e313ee331bb73ca215051f922ccfbf447a6b4d65f5ffa9249c82ff18077968d071ef5fb0771244e41cc1706c75
6
+ metadata.gz: 61a1a30582caccc372d2a4aafd0c17cc81012f77d3ad147665726320cea121f457f6ff9fa5866c806940b68f922c1a3ee376777c330fa2ad817a7c31efd1df6e
7
+ data.tar.gz: e0d49d3a319fae588deb6dfb6069b34bf2d23b9b0f2c431ebe23876a346fda2fd017ff53b97f10923130c5e7397835276fbb0746cab47c8094db5c055c86eeea
@@ -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
- Notify.about(exception)
39
- raise exception
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
  ```
@@ -28,7 +28,7 @@ module GraphQL
28
28
  old_resolve_proc.call(object, arguments, context)
29
29
  rescue => exception
30
30
  if handler = find_handler(exception)
31
- handler.call(exception)
31
+ handler.call(exception, object, arguments, context)
32
32
  else
33
33
  raise exception
34
34
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module GraphQL
4
4
  class Errors
5
- VERSION = "0.1.0"
5
+ VERSION = "0.2.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.1.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: 2017-08-29 00:00:00.000000000 Z
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.5.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