forest_admin_rails 1.12.12 → 1.12.13

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: bdd36d163cb4d1210f6680782fd4338aca9d3c2273fbcfab9ee90cfec91af2b9
4
- data.tar.gz: 1444cac70cd8990f48df0a80579bf0da629898a9f71a2f4082a8bdd4b19a66d3
3
+ metadata.gz: cea143dd5c29a4285ffb243eafb625473c302bd839adbb665ba520084f4a23de
4
+ data.tar.gz: 416268ca11b2830b5851385f25ba6ca22b12b5140d32dcf7275931123c1d4d78
5
5
  SHA512:
6
- metadata.gz: 84dfe389f748592cc51544ad223f7203da823074bfb5e577c4d49dc96ae2ed3810cc7bc53628a8c0a8a2516e1a0f4557fbe90fda3b504f2710ae5709329e2b96
7
- data.tar.gz: 74757f2ff05b7c69ba45ef14aa51a60d970a940cc5a033c868305b6195e21054d5b8c37cf399b4406311aeb4c5faa4b49636ef828ccea2a31d28401bfaaa7cc8
6
+ metadata.gz: b8b37f91c31b93256871986e6aabb53996362d4275b5866e7cbe3c6a65bae0dde2b480a4b7f916351f089aeab216e04e4e3758e97fdf26e040f68ef93e91491e
7
+ data.tar.gz: f462c7dab9f1e8a1ea0e170f95ec2edb6db76ea0b6641f79590e797e1dfb53f797c009cd43a834f8b18d97072f4bf39048a19ba4f841f0ae84e85f4e65d79012
@@ -2,7 +2,7 @@ require 'openid_connect'
2
2
 
3
3
  module ForestAdminRails
4
4
  class ForestController < ActionController::Base
5
- include ForestAdminAgent::Http::ErrorHandling
5
+ include ForestAdminAgent::Http
6
6
 
7
7
  skip_forgery_protection
8
8
 
@@ -61,7 +61,9 @@ module ForestAdminRails
61
61
  end
62
62
 
63
63
  def exception_handler(exception)
64
- http_status = get_error_status(exception)
64
+ http_exception = ErrorTranslator.translate(exception)
65
+
66
+ response.headers.merge!(http_exception.custom_headers || {})
65
67
 
66
68
  data = case exception
67
69
  when ForestAdminAgent::Http::Exceptions::AuthenticationOpenIdClient,
@@ -69,17 +71,17 @@ module ForestAdminRails
69
71
  {
70
72
  error: exception.message,
71
73
  error_description: exception.response,
72
- state: exception.status
74
+ state: http_exception.status
73
75
  }
74
76
  else
75
77
  {
76
78
  errors: [
77
79
  {
78
- name: exception.respond_to?(:name) ? exception.name : exception.class.name,
79
- detail: get_error_message(exception),
80
- status: http_status,
81
- data: exception.try(:data)
82
- }
80
+ name: http_exception.name,
81
+ detail: http_exception.message,
82
+ status: http_exception.status,
83
+ data: http_exception.data
84
+ }.compact
83
85
  ]
84
86
  }
85
87
  end
@@ -88,7 +90,7 @@ module ForestAdminRails
88
90
  ForestAdminAgent::Facades::Container.logger.log('Error', exception.full_message)
89
91
  end
90
92
 
91
- render json: data, status: http_status
93
+ render json: data, status: http_exception.status
92
94
  end
93
95
  end
94
96
  end
@@ -1,3 +1,3 @@
1
1
  module ForestAdminRails
2
- VERSION = "1.12.12"
2
+ VERSION = "1.12.13"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: forest_admin_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.12.12
4
+ version: 1.12.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthieu