Permalink
Browse files

remove wrongheaded uses of "rescue nil" if it will mask a useful exce…

…ption. also include

the whole backtrace in the 500 error response body if exception reporting is turned on (the default).


git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1035 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent c73a414 commit 37270359ac5a4e09eb3caff58963327bfb699460 @leonbreedt leonbreedt committed Mar 29, 2005
@@ -76,10 +76,7 @@ def web_service_invocation(request)
invocation.api = self.class.web_service_api
invocation.service = self
when :delegated, :layered
- invocation.service = web_service_object(invocation.service_name) rescue nil
- unless invocation.service
- raise(DispatcherError, "service #{invocation.service_name} not available")
- end
+ invocation.service = web_service_object(invocation.service_name)
invocation.api = invocation.service.class.web_service_api
end
request.api = invocation.api
@@ -89,10 +89,12 @@ def send_web_service_error_response(request, exception)
else
if self.class.web_service_exception_reporting
message = exception.message
+ backtrace = "\nBacktrace:\n#{exception.backtrace.join("\n")}"
else
message = "Exception raised"
+ backtrace = ""
end
- render_text("Internal protocol error: #{message}", "500 #{message}")
+ render_text("Internal protocol error: #{message}#{backtrace}", "500 #{message}")
end
end
@@ -11,10 +11,7 @@ def encode_rpc_call(method_name, params)
end
def decode_rpc_call(obj)
- method_name, params = XMLRPC::Marshal.load_call(obj) rescue nil
- unless method_name && params
- raise(XmlRpcError, "Malformed XML-RPC request")
- end
+ method_name, params = XMLRPC::Marshal.load_call(obj)
i = 0
params = params.map do |value|
param = XmlRpcDecodedParam.new("param#{i}", value)
@@ -33,10 +30,7 @@ def encode_rpc_response(method_name, return_value)
end
def decode_rpc_response(obj)
- return_value = XMLRPC::Marshal.load_response(obj) rescue nil
- if return_value.nil?
- raise(XmlRpcError, "Malformed XML-RPC response")
- end
+ return_value = XMLRPC::Marshal.load_response(obj)
[nil, XmlRpcDecodedParam.new('return', return_value)]
end
end

0 comments on commit 3727035

Please sign in to comment.