Skip to content

A platform for community discussion. Free, open, simple.

FIX: Improve error handling for messageformat compilation (#28015)

David Tayloreb8a224fd22f
diff --git a/lib/js_locale_helper.rb b/lib/js_locale_helper.rb
index 771984e318d..cfb85f9ddc0 100644
--- a/lib/js_locale_helper.rb
+++ b/lib/js_locale_helper.rb
@@ -162,6 +162,11 @@ module JsLocaleHelper
#{transpiled}
require("discourse-mf");
JS
+ rescue => e
+ Rails.logger.error("Failed to compile message formats for #{locale} '#{e}'")
+ <<~JS
+ console.error("Failed to compile message formats for #{locale}. Some translation strings will be missing.");
+ JS
end
def self.output_locale(locale)