Commit e7dfbe7a23aee1c4fd224b8f72ab955eecd66f06

Authored by Spencer Alan
Committed by GitHub
2 parents 55329049 504d1e22
Exists in master

Merge pull request #3 from lessonly/spenceralan/ch20833/scim-gem-fix-error-handler

fix error rescuing
Gemfile.lock
1 1 PATH
2 2 remote: .
3 3 specs:
4   - scim_rails (0.1.1)
  4 + scim_rails (0.1.2)
5 5 rails (~> 5.0.0)
6 6  
7 7 GEM
... ...
app/controllers/concerns/scim_rails/exception_handler.rb
... ... @@ -12,6 +12,22 @@ module ScimRails
12 12 end
13 13  
14 14 included do
  15 + # StandardError must be ordered _first_ or it will catch all exceptions
  16 + #
  17 + # TODO: Build a plugin/configuration for error handling so that the
  18 + # detailed production errors are logged somewhere if desired.
  19 + if Rails.env.production?
  20 + rescue_from StandardError do
  21 + json_response(
  22 + {
  23 + schemas: ["urn:ietf:params:scim:api:messages:2.0:Error"],
  24 + status: "500"
  25 + },
  26 + :internal_server_error
  27 + )
  28 + end
  29 + end
  30 +
15 31 rescue_from ScimRails::ExceptionHandler::InvalidCredentials do
16 32 json_response(
17 33 {
... ... @@ -79,19 +95,6 @@ module ScimRails
79 95 )
80 96 end
81 97 end
82   -
83   - ## StandardError must be ordered last or it will catch all exceptions
84   - if Rails.env.production?
85   - rescue_from StandardError do
86   - json_response(
87   - {
88   - schemas: ["urn:ietf:params:scim:api:messages:2.0:Error"],
89   - status: "500"
90   - },
91   - :internal_server_error
92   - )
93   - end
94   - end
95 98 end
96 99 end
97 100 end
... ...
lib/scim_rails/version.rb
1 1 module ScimRails
2   - VERSION = '0.1.1'
  2 + VERSION = '0.1.2'
3 3 end
... ...