Skip to content

Commit a59fbd1

Browse files
committed
extract FULL_TEXT_ERRORS check to Utils.full_text_errors_enabled?
1 parent 5a50062 commit a59fbd1

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

lib/react_on_rails/prerender_error.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def calc_message(component_name, console_messages, err, js_code, props)
5757
5858
MSG
5959

60-
backtrace = if ENV["FULL_TEXT_ERRORS"] == "true"
60+
backtrace = if Utils.full_text_errors_enabled?
6161
err.backtrace.join("\n")
6262
else
6363
"#{err.backtrace.first(15).join("\n")}\n" +

lib/react_on_rails/utils.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,10 +185,14 @@ def self.react_on_rails_pro_version
185185
end
186186
end
187187

188+
def self.full_text_errors_enabled?
189+
ENV["FULL_TEXT_ERRORS"] == "true"
190+
end
191+
188192
def self.smart_trim(str, max_length = 1000)
189193
# From https://stackoverflow.com/a/831583/1009332
190194
str = str.to_s
191-
return str if ENV["FULL_TEXT_ERRORS"] == "true"
195+
return str if full_text_errors_enabled?
192196
return str unless str.present? && max_length >= 1
193197
return str if str.length <= max_length
194198

0 commit comments

Comments
 (0)