Skip to content

Commit c9ff3ca

Browse files
committed
supported mapfish print server down case
1 parent 490e603 commit c9ff3ca

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

lib/redmine_gtt_print/mapfish.rb

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,18 @@ def layouts(print_config)
2525
def get_capabilities(print_config)
2626
return unless print_config
2727
str = URI.escape(print_config)
28-
r = HTTParty.get "#{@host}/print/#{str}/capabilities.json"
29-
if r.success?
30-
return JSON.parse r.body
28+
begin
29+
url = "#{@host}/print/#{str}/capabilities.json"
30+
r = HTTParty.get url
31+
if r.success?
32+
return JSON.parse r.body
33+
else
34+
Rails.logger.error "failed to get capabilities from #{url} : #{r.code}\n#{r.body}"
35+
return nil
36+
end
37+
rescue HTTParty::Error, StandardError => e
38+
Rails.logger.error "failed to get capabilities from #{url}\n#{e}"
39+
return nil
3140
end
3241
end
3342

0 commit comments

Comments
 (0)