Exception: HexaPDF::MalformedPDFError

Inherits:
Error
  • Object
show all
Defined in:
lib/hexapdf/error.rb

Overview

Raised when the PDF is invalid and can’t be read correctly.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message, pos:) ⇒ MalformedPDFError

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.



48
49
50
51
# File 'lib/hexapdf/error.rb', line 48

def initialize(message, pos:)
  super(message)
  @pos = pos
end

Instance Attribute Details

#posObject (readonly)

The byte position in the PDF file where the error occured.



43
44
45
# File 'lib/hexapdf/error.rb', line 43

def pos
  @pos
end

Instance Method Details

#messageObject

:nodoc:



53
54
55
# File 'lib/hexapdf/error.rb', line 53

def message # :nodoc:
  "PDF malformed around position #{pos}: #{super}"
end