Improved error handling.

This commit is contained in:
Martin Edenhofer 2015-04-27 13:57:36 +02:00
parent 25cbaf1111
commit 640a90d4fe
2 changed files with 6 additions and 2 deletions

View file

@ -12,6 +12,9 @@ class Locale < ApplicationModel
:json => true, :json => true,
} }
) )
raise "Can't load locales from #{url}: #{result.error}" if !result.success?
result.data.each {|locale| result.data.each {|locale|
puts locale.inspect puts locale.inspect
exists = Locale.where(:locale => locale['locale']).first exists = Locale.where(:locale => locale['locale']).first

View file

@ -15,7 +15,7 @@ load translations from online
=end =end
def self.load def self.load
url = 'http://localhost:3001/api/v1/translations' url = 'https://i18n.zammad.com/api/v1/translations'
if !UserInfo.current_user_id if !UserInfo.current_user_id
UserInfo.current_user_id = 1 UserInfo.current_user_id = 1
end end
@ -26,6 +26,7 @@ load translations from online
:json => true, :json => true,
} }
) )
raise "Can't load translations from #{url}: #{result.error}" if !result.success?
result.data.each {|translation| result.data.each {|translation|
#puts translation.inspect #puts translation.inspect
@ -84,7 +85,7 @@ push translations to online
:json => true, :json => true,
} }
) )
raise result.error if !result.success? raise "Can't push translations to #{url}: #{result.error}" if !result.success?
true true
end end