Skip to content

Commit 960a4ce

Browse files
committed
Raise early if unexpected HTTP response
If the page 500s or 400s, this would be a clearer error.
1 parent e533d5e commit 960a4ce

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

lib/scratch_config_importer.rb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,18 @@ def initialize(asset_config_url, asset_base_url)
1313
end
1414

1515
def import
16-
config = Faraday.get(asset_config_url).body
16+
config = connection.get.body
1717
asset_config = JSON.parse(config, symbolize_names: true)
1818
asset_names = extract_asset_names(asset_config)
1919
ScratchAssetImporter.import(asset_names, asset_base_url)
2020
end
2121

22+
def connection
23+
Faraday.new(url: asset_config_url) do |faraday|
24+
faraday.response :raise_error
25+
end
26+
end
27+
2228
private
2329

2430
def extract_asset_names(config)

0 commit comments

Comments
 (0)