Rescue for SUPPORTED_CHAINS env var parsing

pull/3027/head
Victor Baranov 5 years ago
parent 9d4e921caf
commit 3d9afe59f5
  1. 2
      .dialyzer-ignore
  2. 1
      CHANGELOG.md
  3. 11
      apps/block_scout_web/lib/block_scout_web/views/layout_view.ex
  4. 6
      apps/block_scout_web/test/block_scout_web/views/layout_view_test.exs

@ -12,4 +12,4 @@ apps/explorer/lib/explorer/smart_contract/publisher_worker.ex:6: The pattern 'fa
apps/explorer/lib/explorer/smart_contract/publisher_worker.ex:6: The test 5 == 'infinity' can never evaluate to 'true'
lib/block_scout_web/router.ex:1
lib/phoenix/router.ex:324
lib/block_scout_web/views/layout_view.ex:142
lib/block_scout_web/views/layout_view.ex:143

@ -7,6 +7,7 @@
- [#2834](https://github.com/poanetwork/blockscout/pull/2834) - always redirect to checksummed hash
### Fixes
- [#3027](https://github.com/poanetwork/blockscout/pull/3027) - Rescue for SUPPORTED_CHAINS env var parsing
- [#3025](https://github.com/poanetwork/blockscout/pull/3025) - Fix splitting of indexer/web components setup
- [#3024](https://github.com/poanetwork/blockscout/pull/3024) - Fix pool size default value in config
- [#3021](https://github.com/poanetwork/blockscout/pull/3021), [#3022](https://github.com/poanetwork/blockscout/pull/3022) - Refine dev/test config

@ -137,9 +137,14 @@ defmodule BlockScoutWeb.LayoutView do
def other_networks do
get_other_networks =
if Application.get_env(:block_scout_web, :other_networks) do
:block_scout_web
|> Application.get_env(:other_networks)
|> Parser.parse!(%{keys: :atoms!})
try do
:block_scout_web
|> Application.get_env(:other_networks)
|> Parser.parse!(%{keys: :atoms!})
rescue
_ ->
[]
end
else
@default_other_networks
end

@ -115,6 +115,12 @@ defmodule BlockScoutWeb.LayoutViewTest do
}
]
end
test "get empty networks list if SUPPORTED_CHAINS is not parsed" do
Application.put_env(:block_scout_web, :other_networks, "not a valid json")
assert LayoutView.other_networks() == []
end
end
describe "main_nets/1" do

Loading…
Cancel
Save