lib/the_help/service.rb in the_help-3.2.1 vs lib/the_help/service.rb in the_help-3.3.0
- old
+ new
@@ -318,14 +318,21 @@
def authorize
return if authorized?
logger.warn("Unauthorized attempt to access #{self.class.name}/#{__id__} " \
"as #{context.inspect}")
- run_callback(not_authorized, service: self.class, context: context)
+ result.error run_callback(not_authorized, service: self.class, context: context)
stop!
end
- def stop!
+ def stop!(type: :error, value: nil)
+ if value.nil?
+ check_result!
+ elsif type == :success
+ result.success value
+ else
+ result.error value
+ end
throw :stop
end
def check_result!
raise TheHelp::NoResultError if result.pending?