Skip to content

Commit 0b8611f

Browse files
authored
fix(forest-requester): forest reporter now gets actual error instead of message (#711)
1 parent d1424f4 commit 0b8611f

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

app/services/forest_liana/forest_api_requester.rb

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,10 @@ def self.get(route, query: nil, headers: {})
99
headers: base_headers.merge(headers),
1010
query: query,
1111
}).response
12-
rescue
13-
message = "Cannot reach Forest API at #{forest_api_url}#{route}, it seems to be down right now."
14-
FOREST_LOGGER.error message
15-
FOREST_REPORTER.report message
16-
raise
12+
rescue => error
13+
FOREST_LOGGER.error "Cannot reach Forest API at #{forest_api_url}#{route}, it seems to be down right now."
14+
FOREST_REPORTER.report error
15+
raise error
1716
end
1817
end
1918

@@ -31,11 +30,10 @@ def self.post(route, body: nil, query: nil, headers: {})
3130
query: query,
3231
body: body.to_json,
3332
}).response
34-
rescue
35-
message = "Cannot reach Forest API at #{post_route}, it seems to be down right now."
36-
FOREST_LOGGER.error message
37-
FOREST_REPORTER.report message
38-
raise
33+
rescue => error
34+
FOREST_LOGGER.error "Cannot reach Forest API at #{post_route}, it seems to be down right now."
35+
FOREST_REPORTER.report error
36+
raise error
3937
end
4038
end
4139

0 commit comments

Comments
 (0)