forest_admin_rails 1.0.0.pre.beta.44 → 1.0.0.pre.beta.45

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
2
  SHA256:
3
- metadata.gz: 9faa2b237d6ddd9a3d0603bc1de563d93c9418632b086e1c9988ca7fc8fbabc8
4
- data.tar.gz: 70c1525c885c911a3975fabe8693ea10123b0ecf89b5faba5f5ab8b45cd05528
3
+ metadata.gz: 7696d21374088f19a8d54af303bb426139c107655a26cd6a2b78b2f00e755ffe
4
+ data.tar.gz: 3bceaa9a99729f5158f980225ca0bb9b41ebd7168a050aa498c6447eb9945c73
5
5
  SHA512:
6
- metadata.gz: 6bd123845b5a17467a7da57ef19107a506a18131f09ae53a9418f28dff74d98436a848f72f0955a11c688332c7c3870759ab1dc07730ead9e415f0556fdeca6b
7
- data.tar.gz: 6f204236f0e4972aeacfef7ce82b4f27ce49afbe75e6e59d29cefef6fda8f201d59402f42bfc453ba73c9c02685372847d8578718516b32839b2d7df9afefeb6
6
+ metadata.gz: 6a886fc6b4803e606503ccdc82b096cc397440ba4aa4b18afe04cec4487426d0fa2e9566cdfbcc87f60a93217f46df725ca6b6ea9ba47561e4933d1c36ec6a2b
7
+ data.tar.gz: 43ec992de5b002534b01a74964b3acfc5ef1a83ed3384d6de89a1edea7e3c34a0783fab4d569a4012309907249cb99016cd6b21be3cd08483b63fad417e2a3d9
@@ -47,10 +47,10 @@ module ForestAdminRails
47
47
  }
48
48
 
49
49
  data[:errors][0][:data] = exception.try(:data)
50
+ end
50
51
 
51
- # TODO: IMPLEMENT LOGGING
52
- # if Facades::Container.cache(:is_production)
53
- # end
52
+ unless Facades::Container.cache(:is_production)
53
+ ForestAdminAgent::Facades::Container.logger.log('Debug', exception.full_message)
54
54
  end
55
55
 
56
56
  render json: data, status: exception.try(:status)
@@ -0,0 +1,7 @@
1
+ class ForestAdminErrorSubscriber
2
+ def report(error, _handled:, _severity:, _context:, _source: nil)
3
+ return if Facades::Container.cache(:is_production)
4
+
5
+ ForestAdminAgent::Facades::Container.logger.log('Debug', error.full_message)
6
+ end
7
+ end
data/config/routes.rb CHANGED
@@ -1,5 +1,7 @@
1
1
  ForestAdminRails::Engine.routes.draw do
2
- ForestAdminAgent::Http::Router.routes.each do |name, agent_route|
3
- match agent_route[:uri], to: 'forest#index', via: agent_route[:method], as: name, route_alias: name
2
+ Rails.error.handle(ForestAdminDatasourceToolkit::Exceptions::ForestException) do
3
+ ForestAdminAgent::Http::Router.routes.each do |name, agent_route|
4
+ match agent_route[:uri], to: 'forest#index', via: agent_route[:method], as: name, route_alias: name
5
+ end
4
6
  end
5
7
  end
@@ -22,11 +22,19 @@ module ForestAdminRails
22
22
  class Engine < ::Rails::Engine
23
23
  isolate_namespace ForestAdminRails
24
24
 
25
+ extend ActiveSupport::Concern
26
+
27
+ initializer 'forest_admin_rails.error_subscribe' do
28
+ Rails.error.subscribe(ForestAdminErrorSubscriber.new)
29
+ end
30
+
25
31
  config.after_initialize do
26
- agent_factory = ForestAdminAgent::Builder::AgentFactory.instance
27
- agent_factory.setup(ForestAdminRails.config)
28
- load_configuration
29
- load_cors
32
+ Rails.error.handle(ForestAdminDatasourceToolkit::Exceptions::ForestException) do
33
+ agent_factory = ForestAdminAgent::Builder::AgentFactory.instance
34
+ agent_factory.setup(ForestAdminRails.config)
35
+ load_configuration
36
+ load_cors
37
+ end
30
38
  end
31
39
 
32
40
  def load_configuration
@@ -1,3 +1,3 @@
1
1
  module ForestAdminRails
2
- VERSION = "1.0.0-beta.44"
2
+ VERSION = "1.0.0-beta.45"
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.0.0.pre.beta.44
4
+ version: 1.0.0.pre.beta.45
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthieu
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2024-05-02 00:00:00.000000000 Z
12
+ date: 2024-05-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: dry-configurable
@@ -68,6 +68,7 @@ files:
68
68
  - Rakefile
69
69
  - app/controllers/forest_admin_rails/forest_controller.rb
70
70
  - app/helpers/forest_admin_rails/application_helper.rb
71
+ - config/initializers/forest_admin_error_subscriber.rb
71
72
  - config/routes.rb
72
73
  - lib/forest_admin_rails.rb
73
74
  - lib/forest_admin_rails/engine.rb