Improved error handling.
This commit is contained in:
parent
25cbaf1111
commit
640a90d4fe
2 changed files with 6 additions and 2 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue