@pitr-ch:
module Psych
  class SyntaxError < ::SyntaxError

The code works because Psych::SyntaxError is a subclass of SyntaxError, but you're right -- I should rescue Psych::SyntaxError instead.