summaryrefslogtreecommitdiff
path: root/ext/psych/lib/psych/syntax_error.rb
blob: 9fe3e0da3086302bf0fb6033d8344aa35a67ff2e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
module Psych
  class SyntaxError < ::SyntaxError
    attr_reader :file, :line, :column, :offset, :problem, :context

    def initialize file, line, col, offset, problem, context
      err     = [problem, context].compact.join ' '
      message = "(%s): %s at line %d column %d" % [file, err, line, col]

      @file    = file
      @line    = line
      @column  = col
      @offset  = offset
      @problem = problem
      @context = context
      super(message)
    end
  end
end