lib/simple/httpd/service_integration.rb in simple-httpd-0.3.5 vs lib/simple/httpd/service_integration.rb in simple-httpd-0.4.0
- old
+ new
@@ -1,5 +1,8 @@
+# rubocop:disable Lint/RescueException
+# rubocop:disable Metrics/AbcSize
+
require "simple-service"
module Simple::Httpd::ServiceIntegration
class Adapter
extend Forwardable
@@ -84,12 +87,15 @@
# define sinatra route.
route(verb, path) do
::Simple::Service.with_context(context) do
result = service.invoke(action_name, args: parsed_body, flags: stringified_params)
encode_result(result)
+ rescue Errno::ENOENT => e
+ Simple::Httpd.logger.warn e.to_s
+ raise
rescue Exception => e
- Simple::Httpd.logger.warn "#{e}, from\n #{e.backtrace[0,10].join("\n ")}"
+ Simple::Httpd.logger.warn "#{e}, from\n #{e.backtrace[0, 10].join("\n ")}"
raise
end
end
end
@@ -101,11 +107,14 @@
result = instance_eval(&block)
unless headers["Content-Type"]
result = encode_result(result)
end
result
+ rescue Errno::ENOENT => e
+ Simple::Httpd.logger.warn e.to_s
+ raise
rescue Exception => e
- Simple::Httpd.logger.warn "#{e}, from\n #{e.backtrace[0,10].join("\n ")}"
+ Simple::Httpd.logger.warn "#{e}, from\n #{e.backtrace[0, 10].join("\n ")}"
raise
end
end
end