lib/moleculer/service/action.rb in moleculer-0.2.0 vs lib/moleculer/service/action.rb in moleculer-0.3.0
- old
+ new
@@ -22,11 +22,10 @@
# provided type.
def initialize(name, service, method, options = {})
@name = name
@service = service
@method = method
- @service = service
@options = options
end
##
# @param context [Moleculer::Context] the execution context
@@ -38,21 +37,19 @@
# rubocop disabled because in this case we need a specific error handling format
raise Errors::InvalidActionResponse.new(response) unless response.is_a? Hash # rubocop:disable Style/RaiseArgs
response
rescue StandardError => e
- raise e unless broker.rescue_action
-
- broker.rescue_action.call(e)
+ broker.config.handle_error(e)
end
def node
@service.node
end
- def as_json
+ def to_h
{
- name: "#{@service.service_name}.#{name}",
+ name: "#{@service.full_name}.#{name}",
rawName: name,
cache: HashUtil.fetch(@options, :cache, false),
metrics: {
params: false,
meta: true,