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.



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

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.



46
47
48
# File 'lib/hexapdf/error.rb', line 46

def pos
  @pos
end

Instance Method Details

#messageObject

:nodoc:



56
57
58
# File 'lib/hexapdf/error.rb', line 56

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