From 593ab333363318ffddb00003ac846e8cfa8e6f44 Mon Sep 17 00:00:00 2001 From: mguetlein Date: Tue, 1 Jun 2010 10:49:28 +0200 Subject: adjust error handling for big error msgs --- lib/rest_client_wrapper.rb | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'lib/rest_client_wrapper.rb') diff --git a/lib/rest_client_wrapper.rb b/lib/rest_client_wrapper.rb index 8e1beb4..83089d0 100644 --- a/lib/rest_client_wrapper.rb +++ b/lib/rest_client_wrapper.rb @@ -140,15 +140,15 @@ module OpenTox error = [Error.new(code, body, uri, payload, headers)] end -# #debug utility: write error to file -# error_dir = "/tmp/ot_errors" -# FileUtils.mkdir(error_dir) unless File.exist?(error_dir) -# raise "could not create error dir" unless File.exist?(error_dir) and File.directory?(error_dir) -# file_name = "error" -# time=Time.now.strftime("%m.%d.%Y-%H:%M:%S") -# count = 1 -# count+=1 while File.exist?(File.join(error_dir,file_name+"_"+time+"_"+count.to_s)) -# File.new(File.join(error_dir,file_name+"_"+time+"_"+count.to_s),"w").puts(body) + #debug utility: write error to file + error_dir = "/tmp/ot_errors" + FileUtils.mkdir(error_dir) unless File.exist?(error_dir) + raise "could not create error dir" unless File.exist?(error_dir) and File.directory?(error_dir) + file_name = "error" + time=Time.now.strftime("%m.%d.%Y-%H:%M:%S") + count = 1 + count+=1 while File.exist?(File.join(error_dir,file_name+"_"+time+"_"+count.to_s)) + File.new(File.join(error_dir,file_name+"_"+time+"_"+count.to_s),"w").puts(body) # handle error # we are either in a task, or in sinatra -- cgit v1.2.3