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

We are investigating reports of errors with messageformat compilation following 301713ef. This commit does not fix the issue, but it introduces some basic error handling to avoid completely breaking affected sites.

We will have a fix for the root cause soon.
This commit is contained in:
David Taylor 2024-07-22 13:15:10 +01:00 committed by GitHub
parent dfd4da9656
commit eb8a224fd2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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)