DEV: Replace silent theme-install fails with exceptions (#28485)

Previously, we were silently failing when a theme hit SSRF protection, or the `git clone` command failed for some reason. This commit updates them to be exceptions, so they provide more useful error messages
This commit is contained in:
David Taylor 2024-08-22 12:09:56 +01:00 committed by GitHub
parent a69f3a0880
commit 58c4528a1c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -115,7 +115,8 @@ class ThemeStore::GitImporter < ThemeStore::BaseImporter
addresses = FinalDestination::SSRFDetector.lookup_and_filter_ips(uri.host) addresses = FinalDestination::SSRFDetector.lookup_and_filter_ips(uri.host)
unless addresses.empty? raise_import_error! if addresses.empty?
env = { "GIT_TERMINAL_PROMPT" => "0" } env = { "GIT_TERMINAL_PROMPT" => "0" }
args = args =
@ -128,7 +129,7 @@ class ThemeStore::GitImporter < ThemeStore::BaseImporter
begin begin
Discourse::Utils.execute_command(env, *args, timeout: COMMAND_TIMEOUT_SECONDS) Discourse::Utils.execute_command(env, *args, timeout: COMMAND_TIMEOUT_SECONDS)
rescue RuntimeError rescue RuntimeError
end raise_import_error!
end end
end end