-
-
Save loganhasson/dcbc722e4121e7868756 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'redcarpet' | |
# Custom handler that raises error. | |
# | |
module Redcarpet | |
module Render | |
class Crasher < HTML | |
def paragraph(text) | |
raise "Error!" | |
end | |
end | |
end | |
end | |
redcarpet = Redcarpet::Markdown.new Redcarpet::Render::Crasher | |
# Will loop a certain number of times (always 17 for me for some reason) | |
# and then CRASH with: | |
# | |
# Assertion failed: (md->work_bufs[BUFFER_BLOCK].size == 0), function sd_markdown_render, file markdown.c, line 2544. | |
# Abort trap: 6 | |
# | |
20.times do | |
begin | |
redcarpet.render "Body text." | |
rescue RuntimeError => e | |
puts "Error: #{e.message}" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment