api_error_handler 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/.gitignore +12 -5
- data/.rubocop.yml +30 -0
- data/.rubocop_todo.yml +85 -0
- data/.ruby-version +1 -0
- data/.travis.yml +21 -4
- data/Gemfile +2 -0
- data/README.md +44 -20
- data/Rakefile +3 -1
- data/api_error_handler.gemspec +17 -5
- data/bin/console +1 -0
- data/lib/api_error_handler.rb +11 -8
- data/lib/api_error_handler/action_controller.rb +4 -2
- data/lib/api_error_handler/error_id_generator.rb +23 -0
- data/lib/api_error_handler/error_reporter.rb +46 -0
- data/lib/api_error_handler/errors.rb +6 -1
- data/lib/api_error_handler/serializers/base_serializer.rb +4 -2
- data/lib/api_error_handler/serializers/json.rb +3 -1
- data/lib/api_error_handler/serializers/json_api.rb +3 -1
- data/lib/api_error_handler/serializers/xml.rb +4 -2
- data/lib/api_error_handler/version.rb +3 -1
- metadata +28 -10
- data/bin/test.sh +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 3630f225962137c7df9417b7a6e9654f60ee38ebb8afff7480f74e9daf02a4bc
|
4
|
+
data.tar.gz: 2d644936de3e3d714fe974bb313c8eb14b51c44b2da818f12f8f0f85cd1f0ff7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c41e88553d9cba1cb1679cf1da2205cd8ec3148c5e706a29faf0e9405f6b59666e25da1968a959f52d81bf6982ce90157746e1475b2ee73a10abf86de897cd32
|
7
|
+
data.tar.gz: eb089aed46d76d994fe642c2efebdc9f2598228d877772044069421d5fb2da992b69ce858565f22f1daf68015d1ad5dab9c329115e84584a650d52a17010324a
|
data/.gitignore
CHANGED
@@ -12,8 +12,15 @@
|
|
12
12
|
# rspec failure tracking
|
13
13
|
.rspec_status
|
14
14
|
|
15
|
-
# Stuff to ignore in the
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
15
|
+
# Stuff to ignore in the test_apps
|
16
|
+
rails_5_test_app/tmp
|
17
|
+
rails_5_test_app/log
|
18
|
+
rails_5_test_app/.byebug_history
|
19
|
+
|
20
|
+
rails_4_test_app/tmp
|
21
|
+
rails_4_test_app/log
|
22
|
+
rails_4_test_app/.byebug_history
|
23
|
+
|
24
|
+
rails_6_test_app/tmp
|
25
|
+
rails_6_test_app/log
|
26
|
+
rails_6_test_app/.byebug_history
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
inherit_from: .rubocop_todo.yml
|
2
|
+
|
3
|
+
AllCops:
|
4
|
+
TargetRubyVersion: 2.3
|
5
|
+
Exclude:
|
6
|
+
- 'vendor/**/*'
|
7
|
+
- 'rails_*/**/*'
|
8
|
+
|
9
|
+
Style/StringLiterals:
|
10
|
+
EnforcedStyle: double_quotes
|
11
|
+
|
12
|
+
Metrics/LineLength:
|
13
|
+
Max: 100
|
14
|
+
|
15
|
+
Style/MethodCallWithoutArgsParentheses:
|
16
|
+
Enabled: false
|
17
|
+
|
18
|
+
Style/TrailingCommaInArrayLiteral:
|
19
|
+
EnforcedStyleForMultiline: comma
|
20
|
+
|
21
|
+
Style/TrailingCommaInHashLiteral:
|
22
|
+
EnforcedStyleForMultiline: comma
|
23
|
+
|
24
|
+
Metrics/BlockLength:
|
25
|
+
Exclude:
|
26
|
+
- 'spec/**/*.rb'
|
27
|
+
- 'api_error_handler.gemspec'
|
28
|
+
|
29
|
+
Style/Documentation:
|
30
|
+
Enabled: false
|
data/.rubocop_todo.yml
ADDED
@@ -0,0 +1,85 @@
|
|
1
|
+
# This configuration was generated by
|
2
|
+
# `rubocop --auto-gen-config --auto-gen-only-exclude --exclude-limit 100`
|
3
|
+
# on 2019-08-25 13:23:25 +0100 using RuboCop version 0.74.0.
|
4
|
+
# The point is for the user to remove these configuration records
|
5
|
+
# one by one as the offenses are removed from the code base.
|
6
|
+
# Note that changes in the inspected code, or installation of new
|
7
|
+
# versions of RuboCop, may require this file to be generated again.
|
8
|
+
|
9
|
+
# Offense count: 1
|
10
|
+
# Cop supports --auto-correct.
|
11
|
+
# Configuration parameters: TreatCommentsAsGroupSeparators, Include.
|
12
|
+
# Include: **/*.gemspec
|
13
|
+
Gemspec/OrderedDependencies:
|
14
|
+
Exclude:
|
15
|
+
- 'api_error_handler.gemspec'
|
16
|
+
|
17
|
+
# Offense count: 1
|
18
|
+
# Cop supports --auto-correct.
|
19
|
+
Layout/ClosingParenthesisIndentation:
|
20
|
+
Exclude:
|
21
|
+
- 'spec/api_error_handler/serializers/xml_spec.rb'
|
22
|
+
|
23
|
+
# Offense count: 2
|
24
|
+
# Configuration parameters: Max.
|
25
|
+
Metrics/AbcSize:
|
26
|
+
Exclude:
|
27
|
+
- 'lib/api_error_handler.rb'
|
28
|
+
- 'lib/api_error_handler/error_reporter.rb'
|
29
|
+
|
30
|
+
# Offense count: 1
|
31
|
+
# Configuration parameters: Max.
|
32
|
+
Metrics/CyclomaticComplexity:
|
33
|
+
Exclude:
|
34
|
+
- 'lib/api_error_handler/error_reporter.rb'
|
35
|
+
|
36
|
+
# Offense count: 3
|
37
|
+
# Configuration parameters: CountComments, Max, ExcludedMethods.
|
38
|
+
Metrics/MethodLength:
|
39
|
+
Exclude:
|
40
|
+
- 'lib/api_error_handler.rb'
|
41
|
+
- 'lib/api_error_handler/error_reporter.rb'
|
42
|
+
- 'lib/api_error_handler/error_id_generator.rb'
|
43
|
+
- 'lib/api_error_handler/serializers/json_api.rb'
|
44
|
+
|
45
|
+
# Offense count: 1
|
46
|
+
# Configuration parameters: Max.
|
47
|
+
Metrics/PerceivedComplexity:
|
48
|
+
Exclude:
|
49
|
+
- 'lib/api_error_handler/error_reporter.rb'
|
50
|
+
|
51
|
+
# Offense count: 2
|
52
|
+
# Cop supports --auto-correct.
|
53
|
+
Style/ExpandPathArguments:
|
54
|
+
Exclude:
|
55
|
+
- 'api_error_handler.gemspec'
|
56
|
+
|
57
|
+
# Offense count: 4
|
58
|
+
# Cop supports --auto-correct.
|
59
|
+
# Configuration parameters: EnforcedStyle.
|
60
|
+
# SupportedStyles: implicit, explicit
|
61
|
+
Style/RescueStandardError:
|
62
|
+
Exclude:
|
63
|
+
- 'lib/api_error_handler.rb'
|
64
|
+
- 'spec/api_error_handler/serializers/json_api_spec.rb'
|
65
|
+
- 'spec/api_error_handler/serializers/json_spec.rb'
|
66
|
+
- 'spec/api_error_handler/serializers/xml_spec.rb'
|
67
|
+
|
68
|
+
# Offense count: 2
|
69
|
+
# Cop supports --auto-correct.
|
70
|
+
# Configuration parameters: EnforcedStyleForMultiline.
|
71
|
+
# SupportedStylesForMultiline: comma, consistent_comma, no_comma
|
72
|
+
Style/TrailingCommaInArrayLiteral:
|
73
|
+
Exclude:
|
74
|
+
- 'lib/api_error_handler/serializers/json_api.rb'
|
75
|
+
- 'spec/api_error_handler/serializers/json_api_spec.rb'
|
76
|
+
|
77
|
+
# Offense count: 3
|
78
|
+
# Cop supports --auto-correct.
|
79
|
+
# Configuration parameters: EnforcedStyleForMultiline.
|
80
|
+
# SupportedStylesForMultiline: comma, consistent_comma, no_comma
|
81
|
+
Style/TrailingCommaInHashLiteral:
|
82
|
+
Exclude:
|
83
|
+
- 'lib/api_error_handler.rb'
|
84
|
+
- 'lib/api_error_handler/serializers/json.rb'
|
85
|
+
- 'lib/api_error_handler/serializers/json_api.rb'
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.3.8
|
data/.travis.yml
CHANGED
@@ -1,10 +1,27 @@
|
|
1
1
|
---
|
2
2
|
sudo: false
|
3
3
|
language: ruby
|
4
|
-
rvm:
|
5
|
-
- 2.4
|
6
|
-
cache: bundler
|
7
4
|
before_install:
|
8
5
|
- gem update --system
|
9
6
|
- gem install bundler
|
10
|
-
|
7
|
+
cache: bundler
|
8
|
+
branches:
|
9
|
+
only:
|
10
|
+
- master
|
11
|
+
matrix:
|
12
|
+
include:
|
13
|
+
- rvm: 2.3.8
|
14
|
+
gemfile: ./rails_4_test_app/Gemfile
|
15
|
+
script: cd rails_4_test_app && bundle exec rspec
|
16
|
+
- rvm: 2.3.8
|
17
|
+
gemfile: ./rails_5_test_app/Gemfile
|
18
|
+
script: cd rails_5_test_app && bundle exec rspec
|
19
|
+
- rvm: 2.5.1
|
20
|
+
gemfile: ./rails_6_test_app/Gemfile
|
21
|
+
script: cd rails_6_test_app && bundle exec rspec
|
22
|
+
- rvm: 2.3.8
|
23
|
+
gemfile: Gemfile
|
24
|
+
script: bundle exec rubocop
|
25
|
+
- rvm: 2.3.8
|
26
|
+
gemfile: Gemfile
|
27
|
+
script: bundle exec rspec
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -220,39 +220,29 @@ you're using Rails with ActiveRecord, by default this includes:
|
|
220
220
|
You can add to this mapping on an application level by doing the following:
|
221
221
|
```ruby
|
222
222
|
config.action_dispatch.rescue_responses.merge!(
|
223
|
-
"AuthenticationError" => :
|
223
|
+
"AuthenticationError" => :unauthorized
|
224
224
|
)
|
225
225
|
```
|
226
226
|
|
227
227
|
Now when an you raise an `AuthenticationError` in one of your actions, the
|
228
228
|
status code of the response will be 401.
|
229
229
|
|
230
|
-
### Error Reporting
|
231
|
-
If you use an external error tracking software like Sentry or Honeybadger you'll
|
232
|
-
want to report all errors to that service.
|
233
|
-
|
234
|
-
You can do so by passing in a `Proc` to the `error_reporter` option. The first
|
235
|
-
argument provided to the Proc will be the error. The second argument will be the
|
236
|
-
`error_id` if you have one. See the section below for more details on error IDs.
|
237
|
-
|
238
|
-
```ruby
|
239
|
-
handle_api_errors(
|
240
|
-
error_reporter: Proc.new do |error, error_id|
|
241
|
-
Raven.capture_exception(error, error_id: error_id)
|
242
|
-
end
|
243
|
-
)
|
244
|
-
```
|
245
|
-
|
246
230
|
### Error IDs
|
247
231
|
Sometimes it's helpful to include IDs with your error responses so that you can
|
248
232
|
correlate a specific error with a record in your logs or bug tracking software.
|
233
|
+
For this you can use the `error_id` option.
|
249
234
|
|
235
|
+
You can either use the UUID error strategy
|
250
236
|
```ruby
|
251
|
-
handle_api_errors(
|
252
|
-
error_id: Proc.new { |error| SecureRandom.uuid }
|
253
|
-
)
|
237
|
+
handle_api_errors(error_id: :uuid)
|
254
238
|
```
|
255
239
|
|
240
|
+
Or pass a Proc if you need to do something custom.
|
241
|
+
```ruby
|
242
|
+
handle_api_errors(error_id: Proc.new { |error| SecureRandom.uuid })
|
243
|
+
```
|
244
|
+
|
245
|
+
These will result in:
|
256
246
|
```json
|
257
247
|
{
|
258
248
|
"error": {
|
@@ -263,6 +253,40 @@ handle_api_errors(
|
|
263
253
|
}
|
264
254
|
```
|
265
255
|
|
256
|
+
### Error Reporting
|
257
|
+
If you use an external error tracking software like Sentry or Honeybadger, you'll
|
258
|
+
want to report all errors to that service.
|
259
|
+
|
260
|
+
#### Out of the Box Error Reporting
|
261
|
+
There are a few supported error reporter options that you can select.
|
262
|
+
|
263
|
+
##### Raven/Sentry
|
264
|
+
```ruby
|
265
|
+
handle_api_errors(error_reporter: :raven)
|
266
|
+
# Or
|
267
|
+
handle_api_errors(error_reporter: :sentry)
|
268
|
+
```
|
269
|
+
|
270
|
+
##### Honeybadger
|
271
|
+
```ruby
|
272
|
+
handle_api_errors(error_reporter: :honeybadger)
|
273
|
+
```
|
274
|
+
|
275
|
+
__NOTE:__ If you use the `:error_id` option, the error error reporter will tag
|
276
|
+
the exception with the error ID when reporting the error.
|
277
|
+
|
278
|
+
#### Custom Reporting
|
279
|
+
If none of the out of the box options work for you, you can pass in a proc which
|
280
|
+
will receive the error and the error_id as arguments.
|
281
|
+
|
282
|
+
```ruby
|
283
|
+
handle_api_errors(
|
284
|
+
error_reporter: Proc.new do |error, error_id|
|
285
|
+
# Do something with the `error` here.
|
286
|
+
end
|
287
|
+
)
|
288
|
+
```
|
289
|
+
|
266
290
|
### Setting Content Type
|
267
291
|
The api_error_handler will set the content type of your error based on the
|
268
292
|
`format` option you pick. However, you can override this by setting the
|
data/Rakefile
CHANGED
data/api_error_handler.gemspec
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
|
2
3
|
lib = File.expand_path("../lib", __FILE__)
|
3
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
@@ -8,17 +9,27 @@ Gem::Specification.new do |spec|
|
|
8
9
|
spec.version = ApiErrorHandler::VERSION
|
9
10
|
spec.authors = ["James Stonehill"]
|
10
11
|
spec.email = ["james.stonehill@gmail.com"]
|
11
|
-
spec.required_ruby_version =
|
12
|
+
spec.required_ruby_version = "~> 2.3"
|
13
|
+
|
14
|
+
spec.summary = <<~SUMMARY
|
15
|
+
A gem that helps you easily handle exceptions in your Rails API and return
|
16
|
+
informative responses to the client.
|
17
|
+
SUMMARY
|
18
|
+
|
19
|
+
spec.description = <<~DESCRIPTION
|
20
|
+
A gem that helps you easily handle exceptions in your Ruby on Rails API and
|
21
|
+
return informative responses to the client by serializing exceptions into JSON
|
22
|
+
and other popular API formats and returning a response with a status code that
|
23
|
+
makes sense based on the exception.
|
24
|
+
DESCRIPTION
|
12
25
|
|
13
|
-
spec.summary = %q{A gem that helps you easily handle exceptions in your Rails API and return informative responses to the client.}
|
14
|
-
spec.description = %q{A gem that helps you easily handle exceptions in your Ruby on Rails API and return informative responses to the client by serializing exceptions into JSON and other popular API formats and returning a response with a status code that makes sense based on the exception.}
|
15
26
|
spec.homepage = "https://github.com/jamesstonehill/api_error_handler"
|
16
27
|
spec.license = "MIT"
|
17
28
|
|
18
29
|
# Specify which files should be added to the gem when it is released.
|
19
30
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
20
|
-
spec.files = Dir.chdir(File.expand_path(
|
21
|
-
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features|
|
31
|
+
spec.files = Dir.chdir(File.expand_path("..", __FILE__)) do
|
32
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features|rails_.+)/}) }
|
22
33
|
end
|
23
34
|
spec.bindir = "exe"
|
24
35
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
@@ -31,4 +42,5 @@ Gem::Specification.new do |spec|
|
|
31
42
|
spec.add_development_dependency "bundler", "~> 2.0"
|
32
43
|
spec.add_development_dependency "rake", "~> 10.0"
|
33
44
|
spec.add_development_dependency "rspec-rails", "~> 3.0"
|
45
|
+
spec.add_development_dependency "rubocop", "~> 0.74.0"
|
34
46
|
end
|
data/bin/console
CHANGED
data/lib/api_error_handler.rb
CHANGED
@@ -1,6 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require_relative "./api_error_handler/version"
|
2
4
|
require_relative "./api_error_handler/action_controller"
|
3
|
-
|
5
|
+
require_relative "./api_error_handler/error_id_generator"
|
6
|
+
require_relative "./api_error_handler/error_reporter"
|
7
|
+
Dir[File.join(__dir__, "api_error_handler", "serializers", "*.rb")].each do |file|
|
8
|
+
require file
|
9
|
+
end
|
4
10
|
|
5
11
|
module ApiErrorHandler
|
6
12
|
SERIALIZERS_BY_FORMAT = {
|
@@ -19,22 +25,19 @@ module ApiErrorHandler
|
|
19
25
|
|
20
26
|
def handle_api_errors(options = {})
|
21
27
|
format = options.fetch(:format, :json)
|
22
|
-
|
23
|
-
error_reporter = options[:error_reporter]
|
28
|
+
error_reporter = ErrorReporter.new(options[:error_reporter])
|
24
29
|
serializer_options = SERIALIZER_OPTIONS.merge(
|
25
30
|
options.slice(*SERIALIZER_OPTIONS.keys)
|
26
31
|
)
|
27
32
|
|
28
33
|
serializer_class = options[:serializer] || SERIALIZERS_BY_FORMAT.fetch(format)
|
29
34
|
content_type = options[:content_type] || CONTENT_TYPE_BY_FORMAT[format]
|
30
|
-
|
31
35
|
rescue_from StandardError do |error|
|
32
36
|
begin
|
33
|
-
status =
|
37
|
+
status = ActionDispatch::ExceptionWrapper.rescue_responses[error.class.to_s]
|
34
38
|
|
35
|
-
error_id =
|
36
|
-
|
37
|
-
error_reporter.call(error, error_id) if error_reporter
|
39
|
+
error_id = ErrorIdGenerator.run(options[:error_id])
|
40
|
+
error_reporter.report(error, error_id: error_id)
|
38
41
|
|
39
42
|
serializer = serializer_class.new(error, status)
|
40
43
|
response_body = serializer.serialize(
|
@@ -1,5 +1,7 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "active_support/lazy_load_hooks"
|
4
|
+
require "action_controller"
|
3
5
|
|
4
6
|
ActiveSupport.on_load :action_controller do
|
5
7
|
::ActionController::Base.send :extend, ApiErrorHandler
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "securerandom"
|
4
|
+
require_relative "./errors"
|
5
|
+
|
6
|
+
module ApiErrorHandler
|
7
|
+
class ErrorIdGenerator
|
8
|
+
def self.run(error_id_option)
|
9
|
+
if error_id_option.instance_of?(Proc)
|
10
|
+
error_id_option.call
|
11
|
+
elsif error_id_option == :uuid
|
12
|
+
SecureRandom.uuid
|
13
|
+
elsif error_id_option.nil?
|
14
|
+
nil
|
15
|
+
else
|
16
|
+
raise(
|
17
|
+
InvalidOptionError,
|
18
|
+
"Unable to handle `#{error_id_option}` as argument for the `:error_id` option."
|
19
|
+
)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "logger"
|
4
|
+
require_relative "./errors"
|
5
|
+
|
6
|
+
module ApiErrorHandler
|
7
|
+
class ErrorReporter
|
8
|
+
def initialize(strategy)
|
9
|
+
@strategy = strategy
|
10
|
+
end
|
11
|
+
|
12
|
+
def report(error, error_id: nil)
|
13
|
+
if @strategy.nil?
|
14
|
+
true
|
15
|
+
elsif @strategy.instance_of?(Proc)
|
16
|
+
@strategy.call(error, error_id)
|
17
|
+
elsif @strategy == :honeybadger
|
18
|
+
raise_dependency_error(missing_constant: "Honeybadger") unless defined?(Honeybadger)
|
19
|
+
|
20
|
+
context = error_id ? { error_id: error_id } : {}
|
21
|
+
Honeybadger.notify(error, context: context)
|
22
|
+
elsif @strategy == :raven || @strategy == :sentry
|
23
|
+
raise_dependency_error(missing_constant: "Raven") unless defined?(Raven)
|
24
|
+
|
25
|
+
extra = error_id ? { error_id: error_id } : {}
|
26
|
+
Raven.capture_exception(error, extra: extra)
|
27
|
+
else
|
28
|
+
raise(
|
29
|
+
InvalidOptionError,
|
30
|
+
"`#{@strategy.inspect}` is an invalid argument for the `:error_id` option."
|
31
|
+
)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
private
|
36
|
+
|
37
|
+
def raise_dependency_error(missing_constant:)
|
38
|
+
raise MissingDependencyError, <<~MESSAGE
|
39
|
+
You selected the #{@strategy.inspect} error reporter option but the
|
40
|
+
#{missing_constant} constant is not defined. If you wish to use this
|
41
|
+
error reporting option you must have the #{@strategy} client gem
|
42
|
+
installed.
|
43
|
+
MESSAGE
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -1,9 +1,11 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "rack/utils"
|
2
4
|
|
3
5
|
module ApiErrorHandler
|
4
6
|
module Serializers
|
5
7
|
class BaseSerializer
|
6
|
-
DEFAULT_STATUS_CODE = "500"
|
8
|
+
DEFAULT_STATUS_CODE = "500"
|
7
9
|
|
8
10
|
def initialize(error, status)
|
9
11
|
@error = error
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: api_error_handler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Stonehill
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-08-
|
11
|
+
date: 2019-08-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -94,10 +94,25 @@ dependencies:
|
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '3.0'
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rubocop
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 0.74.0
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 0.74.0
|
111
|
+
description: |
|
112
|
+
A gem that helps you easily handle exceptions in your Ruby on Rails API and
|
113
|
+
return informative responses to the client by serializing exceptions into JSON
|
114
|
+
and other popular API formats and returning a response with a status code that
|
115
|
+
makes sense based on the exception.
|
101
116
|
email:
|
102
117
|
- james.stonehill@gmail.com
|
103
118
|
executables: []
|
@@ -106,6 +121,9 @@ extra_rdoc_files: []
|
|
106
121
|
files:
|
107
122
|
- ".gitignore"
|
108
123
|
- ".rspec"
|
124
|
+
- ".rubocop.yml"
|
125
|
+
- ".rubocop_todo.yml"
|
126
|
+
- ".ruby-version"
|
109
127
|
- ".travis.yml"
|
110
128
|
- Gemfile
|
111
129
|
- LICENSE.txt
|
@@ -114,9 +132,10 @@ files:
|
|
114
132
|
- api_error_handler.gemspec
|
115
133
|
- bin/console
|
116
134
|
- bin/setup
|
117
|
-
- bin/test.sh
|
118
135
|
- lib/api_error_handler.rb
|
119
136
|
- lib/api_error_handler/action_controller.rb
|
137
|
+
- lib/api_error_handler/error_id_generator.rb
|
138
|
+
- lib/api_error_handler/error_reporter.rb
|
120
139
|
- lib/api_error_handler/errors.rb
|
121
140
|
- lib/api_error_handler/serializers/base_serializer.rb
|
122
141
|
- lib/api_error_handler/serializers/json.rb
|
@@ -135,15 +154,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
135
154
|
requirements:
|
136
155
|
- - "~>"
|
137
156
|
- !ruby/object:Gem::Version
|
138
|
-
version: '2.
|
157
|
+
version: '2.3'
|
139
158
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
140
159
|
requirements:
|
141
160
|
- - ">="
|
142
161
|
- !ruby/object:Gem::Version
|
143
162
|
version: '0'
|
144
163
|
requirements: []
|
145
|
-
|
146
|
-
rubygems_version: 2.6.14.4
|
164
|
+
rubygems_version: 3.0.6
|
147
165
|
signing_key:
|
148
166
|
specification_version: 4
|
149
167
|
summary: A gem that helps you easily handle exceptions in your Rails API and return
|
data/bin/test.sh
DELETED