OSDN Git Service

Better message for a failure case
authorbeatles <beatles@b8c68f68-1e22-0410-b08e-880e1f8202b4>
Sun, 30 Nov 2008 09:15:35 +0000 (09:15 +0000)
committerbeatles <beatles@b8c68f68-1e22-0410-b08e-880e1f8202b4>
Sun, 30 Nov 2008 09:15:35 +0000 (09:15 +0000)
showgame/controller/main.rb

index cf32f34..b71bcfb 100644 (file)
@@ -5,11 +5,14 @@
 #  map '/otherurl'
 # this will force the controller to be mounted on: /otherurl
 
 #  map '/otherurl'
 # this will force the controller to be mounted on: /otherurl
 
-require File.join(__DIR__, "..", "..", "shogi_server", "piece")
-require File.join(__DIR__, "..", "..", "shogi_server", "board")
-require File.join(__DIR__, "..", "..", "shogi_server", "usi")
+$:.unshift File.join(__DIR__, "..", "..")
+$:.unshift File.join(__DIR__, "..", "gen-rb")
 
 
-require File.join(__DIR__, "..", "gen-rb", "ShogiGraphic")
+require "shogi_server/piece"
+require "shogi_server/board"
+require "shogi_server/usi"
+
+require "ShogiGraphic"
 require 'thrift/transport/socket'
 require 'thrift/protocol/tbinaryprotocol'
 
 require 'thrift/transport/socket'
 require 'thrift/protocol/tbinaryprotocol'
 
@@ -56,7 +59,7 @@ class MainController < Ramaze::Controller
     result = client.usi2png(str)
     transport.close
 
     result = client.usi2png(str)
     transport.close
 
-    Ramaze::Log.warn("result fail") unless result
+    Ramaze::Log.error("Failed to get an image of %s from the Thrift server" % [str]) if !result || result.empty?
     @img = "/images/%s" % [result]
   end
 
     @img = "/images/%s" % [result]
   end