Skip to content

Commit bb122e8

Browse files
author
Kyle Decot
committed
Shorter syntax for catching exceptions
1 parent c7b8822 commit bb122e8

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

lib/kmdata.rb

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,11 @@ def endpoint
1111
end
1212

1313
def get(path, params = {})
14-
begin
15-
path = path_with_params("/api/#{path}.json", params)
16-
response = http.request(Net::HTTP::Get.new(path))
17-
process(JSON.parse(response.body))
18-
rescue Exception => exception
19-
return false
20-
end
14+
path = path_with_params("/api/#{path}.json", params)
15+
response = http.request(Net::HTTP::Get.new(path))
16+
process(JSON.parse(response.body))
17+
rescue Exception => exception
18+
return false
2119
end
2220

2321
private

0 commit comments

Comments
 (0)