graphiti_errors 1.1.1 → 1.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c439d87d996ad5e3f751dcc69346a7cc9bbb827db0fc884dd6a75ff0e8205561
4
- data.tar.gz: 0cbb4e08957b9f7ef05e03b1caf6737429d44b2a3b8edba7500777def0d49047
3
+ metadata.gz: 6eac14bef8a9004d3ab1e5eeba886f693e7092b78a950a0cff8c9edf25b4a69c
4
+ data.tar.gz: 84dd7746013d13fe43a03745e105e5a5f845189823b6e5c0258a2b6e88c98fb7
5
5
  SHA512:
6
- metadata.gz: f32980eba6b37677bb3a7c064d3ae7723900ce5e992745423d06f22d7a7bb471be6a0285294e2a8eaf2d3b60c19596f0ac5a96a69e9274d2db6fc530fb8daea3
7
- data.tar.gz: 38dba2c032bee466ab80da61b32fd105b734a6d91d0b12aeb1c9040286e3325c423dbae1d3744b10bf023a9590696a680838d5af631babf176e63b1ada2c9d0e
6
+ metadata.gz: d23076704344134711bc9eb048ff7d73a1990ae89d46c7004b0b32539d35b30ac5a086d3713a1879246941d347ee3e6e01b0ead57ab599f8463439a5b39d959c
7
+ data.tar.gz: 98c33a10046cfdd481ae3c6ec7191e914c66f7d228d4b86943ceaaf4acdc71b7d7b969e95304dbe9d00866bdd9b8319892017898986e852ff69c82001cd606bc
data/.gitignore CHANGED
@@ -7,3 +7,4 @@
7
7
  /pkg/
8
8
  /spec/reports/
9
9
  /tmp/
10
+ *~
@@ -1 +1 @@
1
- 2.5.2
1
+ 2.5.1
@@ -4,6 +4,8 @@ require "graphiti_errors/version"
4
4
  require "graphiti_errors/exception_handler"
5
5
  require "graphiti_errors/invalid_request/serializer"
6
6
  require "graphiti_errors/invalid_request/exception_handler"
7
+ require "graphiti_errors/conflict_request/serializer"
8
+ require "graphiti_errors/conflict_request/exception_handler"
7
9
  require "graphiti_errors/validation/serializer"
8
10
 
9
11
  module GraphitiErrors
@@ -14,6 +16,7 @@ module GraphitiErrors
14
16
  end
15
17
 
16
18
  def self.inherited(subklass)
19
+ super
17
20
  subklass._errorable_registry = _errorable_registry.dup
18
21
  end
19
22
  end
@@ -24,6 +27,11 @@ module GraphitiErrors
24
27
  klass.register_exception Graphiti::Errors::InvalidRequest,
25
28
  handler: GraphitiErrors::InvalidRequest::ExceptionHandler
26
29
  end
30
+
31
+ if defined?(Graphiti::Errors::ConflictRequest)
32
+ klass.register_exception Graphiti::Errors::ConflictRequest,
33
+ handler: GraphitiErrors::ConflictRequest::ExceptionHandler
34
+ end
27
35
  end
28
36
 
29
37
  def self.disable!
@@ -0,0 +1,9 @@
1
+ module GraphitiErrors
2
+ module ConflictRequest
3
+ class ExceptionHandler < GraphitiErrors::InvalidRequest::ExceptionHandler
4
+ def status_code(error)
5
+ 409
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,10 @@
1
+ module GraphitiErrors
2
+ module ConflictRequest
3
+ class Serializer < InvalidRequest::Serializer
4
+ def initialize(errors)
5
+ super(errors)
6
+ @status_code = 409
7
+ end
8
+ end
9
+ end
10
+ end
@@ -4,6 +4,7 @@ module GraphitiErrors
4
4
  attr_reader :errors
5
5
  def initialize(errors)
6
6
  @errors = errors
7
+ @status_code = 400
7
8
  end
8
9
 
9
10
  def rendered_errors
@@ -15,7 +16,7 @@ module GraphitiErrors
15
16
 
16
17
  errors_payload << {
17
18
  code: "bad_request",
18
- status: "400",
19
+ status: @status_code.to_s,
19
20
  title: "Request Error",
20
21
  detail: errors.full_message(attribute, message),
21
22
  source: {
@@ -1,3 +1,3 @@
1
1
  module GraphitiErrors
2
- VERSION = "1.1.1"
2
+ VERSION = "1.1.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: graphiti_errors
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lee Richmond
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-10-09 00:00:00.000000000 Z
11
+ date: 2020-05-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jsonapi-serializable
@@ -134,6 +134,8 @@ files:
134
134
  - gemfiles/rails_6.gemfile
135
135
  - graphiti_errors.gemspec
136
136
  - lib/graphiti_errors.rb
137
+ - lib/graphiti_errors/conflict_request/exception_handler.rb
138
+ - lib/graphiti_errors/conflict_request/serializer.rb
137
139
  - lib/graphiti_errors/exception_handler.rb
138
140
  - lib/graphiti_errors/invalid_request/exception_handler.rb
139
141
  - lib/graphiti_errors/invalid_request/serializer.rb
@@ -158,7 +160,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
158
160
  - !ruby/object:Gem::Version
159
161
  version: '0'
160
162
  requirements: []
161
- rubygems_version: 3.0.6
163
+ rubyforge_project:
164
+ rubygems_version: 2.7.6
162
165
  signing_key:
163
166
  specification_version: 4
164
167
  summary: Error-handling patterns for JSONAPIs