summaryrefslogtreecommitdiff
path: root/ext/psych/lib/psych
diff options
context:
space:
mode:
Diffstat (limited to 'ext/psych/lib/psych')
-rw-r--r--ext/psych/lib/psych/syntax_error.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/ext/psych/lib/psych/syntax_error.rb b/ext/psych/lib/psych/syntax_error.rb
new file mode 100644
index 0000000000..9fe3e0da30
--- /dev/null
+++ b/ext/psych/lib/psych/syntax_error.rb
@@ -0,0 +1,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