/** * Construct a new invalid marker exception. * * The exception will contain a message describing the error, * including the byte found and the offset of the offending byte. * * @param int the byte found. * * @param int the offset in the data. */ function __construct($marker, $offset) { parent::__construct('Invalid marker found at offset %d: 0x%2X', $offset, $marker); }
/** * Construct a new overflow exception. * * @param int the value that is out of range. * * @param int the minimum allowed value. * * @param int the maximum allowed value. */ function __construct($v, $min, $max) { parent::__construct('Value %.0f out of range [%.0f, %.0f]', $v, $min, $max); }
/** * Conditionally throw an exception. * * This method will throw the passed exception when strict parsing * in effect (see {@link setStrictParsing()}). Otherwise the * exception is stored (it can be accessed with {@link * getExceptions()}) and a warning is issued (with {@link * Pel::warning}). * * @param PelException $e * the exceptions. */ public static function maybeThrow(PelException $e) { if (self::$strict) { throw $e; } else { self::$exceptions[] = $e; self::warning('%s (%s:%s)', $e->getMessage(), basename($e->getFile()), $e->getLine()); } }