Page will try to render itself in revise method, and behave appropriately if markup engine fails [inspired by Denis]

This commit is contained in:
Alexey Verkhovsky 2005-01-30 04:50:41 +00:00
parent 2e9e82bd0a
commit 85bc93984d
3 changed files with 43 additions and 13 deletions

View file

@ -79,5 +79,21 @@ class Revision
def display_content_for_export
WikiContent.new(self, {:mode => :export} )
end
def force_rendering
begin
display_content
rescue Exception => e
ApplicationController.logger.error "Failed rendering page #{@name}"
ApplicationController.logger.error e
message = e.message.gsub(/\n/, '<br/>')
# substitute content with an error message
content = <<-EOL
<p>Markup engine has failed to render this page, raising the following error:</p>
<p>#{message}</p>
EOL
raise e
end
end
end