From 640a90d4fefacaeca7726ad53639ef7dac545061 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Mon, 27 Apr 2015 13:57:36 +0200 Subject: [PATCH] Improved error handling. --- app/models/locale.rb | 3 +++ app/models/translation.rb | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/models/locale.rb b/app/models/locale.rb index a17881b23..2c1c8f167 100644 --- a/app/models/locale.rb +++ b/app/models/locale.rb @@ -12,6 +12,9 @@ class Locale < ApplicationModel :json => true, } ) + + raise "Can't load locales from #{url}: #{result.error}" if !result.success? + result.data.each {|locale| puts locale.inspect exists = Locale.where(:locale => locale['locale']).first diff --git a/app/models/translation.rb b/app/models/translation.rb index b6e36d2a6..8a82a4cbd 100644 --- a/app/models/translation.rb +++ b/app/models/translation.rb @@ -15,7 +15,7 @@ load translations from online =end def self.load - url = 'http://localhost:3001/api/v1/translations' + url = 'https://i18n.zammad.com/api/v1/translations' if !UserInfo.current_user_id UserInfo.current_user_id = 1 end @@ -26,6 +26,7 @@ load translations from online :json => true, } ) + raise "Can't load translations from #{url}: #{result.error}" if !result.success? result.data.each {|translation| #puts translation.inspect @@ -84,7 +85,7 @@ push translations to online :json => true, } ) - raise result.error if !result.success? + raise "Can't push translations to #{url}: #{result.error}" if !result.success? true end