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