servactory 2.2.1 → 2.2.2

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: 1d6caa4bc22185741274dfaa2482bb254795dfa692f7890de4ec47651fd3a574
4
- data.tar.gz: e7852ab4e6edc5be891f3551c5c7daccd7ab90d5e448cae08b4efc115278af0a
3
+ metadata.gz: d6c205eaf58dfc9f10040d0b5a60324ee63ed72dfc1643df149646232ce73c46
4
+ data.tar.gz: b88daadf5ed2d8645eca11d1d4ea9bdd86175b52a3297f57f232b068239a070b
5
5
  SHA512:
6
- metadata.gz: e1dad15de09d231e20f79b5fbf0a51b4fb4a7f17f23797bbe1a2adae97e53cb036ed056be687342847897b3bb7e3b7724d399409f270f27d5a2c061fa9c2e33f
7
- data.tar.gz: ac7036078315e72298aac49674111adf3d15ccc6c7b643ee75bff9c5ac92078a5915d27b1c560ce33eebbc55ed50ac747306ed6ea9cfd9c76d6e311e64cfe513
6
+ metadata.gz: 4f08e497b7044ab6c6ec5c53d2e87538ef7666cea055cdd3fac5d86c8ff699367ca606b508eebc25c022e9f8ad9c44d70a9bd5ce8d4d0b48634c5268aea88f29
7
+ data.tar.gz: 5b3bdb880e5251115e21ddf47f66350cd1f1f86ae434080190d04277c8d60d8e9c0d3628c5f84c91d4a31f4c7a3df3266d5f35bfe88fadc842a4c9596d9e4554
@@ -1,9 +1,8 @@
1
1
  en:
2
2
  servactory:
3
3
  common:
4
- undefined_local_variable_or_method: "[%{service_class_name}] Undefined local variable or method `%{method_name}`"
5
4
  undefined_method:
6
- missing_name: "[%{service_class_name}] Undefined method `%{method_name}` for `%{missing_name}`"
5
+ missing_name: "[%{service_class_name}] %{error_text}"
7
6
  methods:
8
7
  call:
9
8
  not_used: "[%{service_class_name}] Nothing to perform. Use `make` or create a `call` method."
@@ -1,9 +1,8 @@
1
1
  ru:
2
2
  servactory:
3
3
  common:
4
- undefined_local_variable_or_method: "[%{service_class_name}] Неопределенная локальная переменная или метод `%{method_name}`"
5
4
  undefined_method:
6
- missing_name: "[%{service_class_name}] Неопределенный метод `%{method_name}` для `%{missing_name}`"
5
+ missing_name: "[%{service_class_name}] %{error_text}"
7
6
  methods:
8
7
  call:
9
8
  not_used: "[%{service_class_name}] Нечего выполнять. Используйте `make` или создайте метод `call`."
@@ -57,10 +57,6 @@ module Servactory
57
57
 
58
58
  def call_method(method)
59
59
  @context.send(method.name)
60
- rescue NoMethodError => e
61
- rescue_no_method_error_with(exception: e)
62
- rescue NameError
63
- rescue_name_error_with(method: method)
64
60
  end
65
61
 
66
62
  def unnecessary_for_stage?(stage)
@@ -87,37 +83,6 @@ module Servactory
87
83
 
88
84
  !condition.call(context: @context)
89
85
  end
90
-
91
- ########################################################################
92
-
93
- def rescue_no_method_error_with(exception:) # rubocop:disable Metrics/MethodLength
94
- raise @context.class.config.failure_class.new(
95
- type: :base,
96
- message: I18n.t(
97
- "servactory.common.undefined_method.missing_name",
98
- service_class_name: @context.class.name,
99
- method_name: exception.name,
100
- missing_name: if exception.missing_name.nil?
101
- exception.missing_name.inspect
102
- elsif exception.missing_name == "NilClass"
103
- nil.inspect
104
- else
105
- exception.missing_name
106
- end
107
- )
108
- )
109
- end
110
-
111
- def rescue_name_error_with(method:)
112
- raise @context.class.config.failure_class.new(
113
- type: :base,
114
- message: I18n.t(
115
- "servactory.common.undefined_local_variable_or_method",
116
- service_class_name: @context.class.name,
117
- method_name: method.name
118
- )
119
- )
120
- end
121
86
  end
122
87
  end
123
88
  end
@@ -93,7 +93,7 @@ module Servactory
93
93
 
94
94
  ########################################################################
95
95
 
96
- def rescue_no_method_error_with(exception:)
96
+ def rescue_no_method_error_with(exception:) # rubocop:disable Metrics/MethodLength
97
97
  raise exception if @context.blank?
98
98
 
99
99
  raise @context.class.config.failure_class.new(
@@ -101,9 +101,11 @@ module Servactory
101
101
  message: I18n.t(
102
102
  "servactory.common.undefined_method.missing_name",
103
103
  service_class_name: @context.class.name,
104
- method_name: exception.name,
105
- missing_name: exception.missing_name.inspect
106
- )
104
+ error_text: exception.message
105
+ ),
106
+ meta: {
107
+ original_exception: exception
108
+ }
107
109
  )
108
110
  end
109
111
  end
@@ -4,7 +4,7 @@ module Servactory
4
4
  module VERSION
5
5
  MAJOR = 2
6
6
  MINOR = 2
7
- PATCH = 1
7
+ PATCH = 2
8
8
  PRE = nil
9
9
 
10
10
  STRING = [MAJOR, MINOR, PATCH, PRE].compact.join(".")
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: servactory
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.1
4
+ version: 2.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anton Sokolov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-02-28 00:00:00.000000000 Z
11
+ date: 2024-03-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport