[logaling-commit] logaling/logaling-command [import-tmx] rescue when failed open url/path

Back to archive index

null+****@clear***** null+****@clear*****
Fri Apr 27 19:17:10 JST 2012


SUZUKI Miho	2012-04-27 19:17:10 +0900 (Fri, 27 Apr 2012)

  New Revision: e6a494218c9cd51d5daf10b4ba91ec12f3eeaad1

  Log:
    rescue when failed open url/path

  Modified files:
    lib/logaling/command/application.rb
    lib/logaling/external_glossaries/tmx.rb
    lib/logaling/repository.rb

  Modified: lib/logaling/command/application.rb (+2 -0)
===================================================================
--- lib/logaling/command/application.rb    2012-04-27 19:15:04 +0900 (1547738)
+++ lib/logaling/command/application.rb    2012-04-27 19:17:10 +0900 (4a40faf)
@@ -103,6 +103,8 @@ module Logaling::Command
     rescue Logaling::ExternalGlossaryNotFound
       say "'#{external_glossary}' can't find in import list."
       say "Try 'loga import --list' and confirm import list."
+    rescue Logaling::GlossaryNotFound => e
+      say e.message
     end
 
     desc 'register', 'Register .logaling'

  Modified: lib/logaling/external_glossaries/tmx.rb (+2 -0)
===================================================================
--- lib/logaling/external_glossaries/tmx.rb    2012-04-27 19:15:04 +0900 (02ac5ba)
+++ lib/logaling/external_glossaries/tmx.rb    2012-04-27 19:17:10 +0900 (66a7f27)
@@ -48,6 +48,8 @@ module Logaling
         end
         csv << [original, translation, notes.join(" | ")] if original && translation
       end
+    rescue
+      raise Logaling::GlossaryNotFound, "Failed open url / path <#{glossary_info[:url]}>"
     end
   end
 end

  Modified: lib/logaling/repository.rb (+2 -0)
===================================================================
--- lib/logaling/repository.rb    2012-04-27 19:15:04 +0900 (9ab399a)
+++ lib/logaling/repository.rb    2012-04-27 19:17:10 +0900 (5fbdc7d)
@@ -59,6 +59,8 @@ module Logaling
       Dir.chdir(cache_path) do
         glossary.import(glossary_info)
       end
+    rescue Logaling::GlossaryNotFound => e
+      raise e
     rescue
       raise Logaling::CommandFailed, "Failed import_tmx #{glossary.class.name} to #{cache_path}."
     end




More information about the logaling-commit mailing list
Back to archive index