Method: RBPDF#Error

Defined in:
lib/rbpdf.rb

#Error(msg, err = nil) ⇒ Object Also known as: error

This method is automatically called in case of fatal error; it simply outputs the message and halts the execution. An inherited class may override it to customize the error handling but should always halt the script, or the resulting document would probably be invalid.

  • 2004-06-11

    Nicola Asuni : changed bold tag with strong

@param string :msg

The error message

@param string :err

Exception object

@access public
@since 1.0

Raises:



1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
# File 'lib/rbpdf.rb', line 1528

def Error(msg, err = nil)
  if /^.+?:\d+(?::in `(.*)')?/ =~ caller(2).first
    method = $1
  end
  if err and err.class != RBPDFError
    logger.error "pdf: #{method}: #{err.message}"
    err.backtrace.each{|trace|
      logger.error trace
    }
  end
  raise RBPDFError, "RBPDF error: #{msg}"
end