Skip to content
This repository was archived by the owner on Jul 22, 2025. It is now read-only.

Commit a349b9d

Browse files
committed
debugging code, will remove
1 parent c1b7804 commit a349b9d

File tree

1 file changed

+13
-6
lines changed
  • lib/ai_bot/artifact_update_strategies

1 file changed

+13
-6
lines changed

lib/ai_bot/artifact_update_strategies/diff.rb

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,19 @@ def apply_changes(changes)
5050

5151
content = source.public_send(section == :javascript ? :js : section)
5252
blocks.each do |block|
53-
content =
54-
DiscourseAi::Utils::DiffUtils::SimpleDiff.apply(
55-
content,
56-
block[:search],
57-
block[:replace],
58-
)
53+
begin
54+
content =
55+
DiscourseAi::Utils::DiffUtils::SimpleDiff.apply(
56+
content,
57+
block[:search],
58+
block[:replace],
59+
)
60+
rescue StandardError => e
61+
File.write("/tmp/x/content", content)
62+
File.write("/tmp/x/search", block[:search])
63+
File.write("/tmp/x/replace", block[:replace])
64+
raise e
65+
end
5966
end
6067
updated_content[section == :javascript ? :js : section] = content
6168
end

0 commit comments

Comments
 (0)