summaryrefslogtreecommitdiff
path: root/lib/psych/syntax_error.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/psych/syntax_error.rb')
-rw-r--r--lib/psych/syntax_error.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/psych/syntax_error.rb b/lib/psych/syntax_error.rb
index 9fe3e0d..f79743d 100644
--- a/lib/psych/syntax_error.rb
+++ b/lib/psych/syntax_error.rb
@@ -3,8 +3,9 @@ module Psych
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]
+ err = [problem, context].compact.join ' '
+ filename = file || '<unknown>'
+ message = "(%s): %s at line %d column %d" % [filename, err, line, col]
@file = file
@line = line