lib/hexapdf/error.rb in hexapdf-0.14.3 vs lib/hexapdf/error.rb in hexapdf-0.14.4

- old
+ new

@@ -45,17 +45,17 @@ # The byte position in the PDF file where the error occured. attr_reader :pos # Creates a new malformed PDF error object for the given exception message. # - # The byte position where the error occured has to be given via the +pos+ argument. - def initialize(message, pos:) + # The byte position where the error occured can be given via the +pos+ argument. + def initialize(message, pos: nil) super(message) @pos = pos end def message # :nodoc: - "PDF malformed around position #{pos}: #{super}" + "PDF malformed#{pos ? "around position #{pos}" : ''}: #{super}" end end # Raised when a filter encounters a problem during decoding or encoding.