Undefined local variable or method `e' during phpbb3 migration


(mbajur) #1

During a phpbb3 migration, for one of the posts, importer throws:

28291 / 1126938 (  2.5%)  [583509 items/min]  /var/www/discourse/script/import_scripts/phpbb3/support/text_processor.rb:56:in `rescue in bbcode_to_md': undefined local variable or method `e' for #<ImportScripts::PhpBB3::TextProcessor:0x007f41aa627198> (NameError)
        from /var/www/discourse/script/import_scripts/phpbb3/support/text_processor.rb:54:in `bbcode_to_md'

FYI: i’ve been following an official docker-based migration guide.


Edit: I’ve been able to fix this by editing the #bbcode_to_md method to:

def bbcode_to_md(text)
  begin
    text.bbcode_to_md(false)
 
  # Added `=>` below
  rescue => e
    puts "Problem converting \n#{text}\n using ruby-bbcode-to-md"
    text
  end
end

(Jeff Atwood) #2

Sure this is something @gerhard should take a peek at.


(Alan Tan) #3

Your fix is correct :slight_smile: Can you submit a PR?


(mbajur) #4

Sure thing :slight_smile: will do in a bit


(mbajur) #5

Ok, done: Add missing fat arrow in bbcode_to_md method rescue block by mbajur · Pull Request #4404 · discourse/discourse · GitHub


(Alan Tan) #6

Merged :slight_smile:


(Alan Tan) #7