*/
public function __construct (array $messageArray, $code) {
// Construct the message
- $message = sprintf("[%s:%d] The final chunk %s is not a valid EOP (%s) chunk. Total chunks: %s",
+ $message = sprintf("[%s:%d] The final chunk %s is not a valid EOP (%s) chunk. Total chunks: %s, cause: %s",
$messageArray[0]->__toString(),
$this->getLine(),
$messageArray[1][count($messageArray[1]) - 1],
PackageFragmenter::END_OF_PACKAGE_IDENTIFIER,
- count($messageArray[1])
+ count($messageArray[1]),
+ $messageArray[2]->__toString()
);
// Call parent exception constructor
$chunkSplits = explode(PackageFragmenter::CHUNK_DATA_HASH_SEPARATOR, $chunks[count($chunks) - 1]);
// Make sure chunks with only 3 elements are parsed (for details see ChunkHandler)
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('eopChunk=' . $chunks[count($chunks) - 1] . ',chunkSplits=' . print_r($chunkSplits,true));
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('eopChunk=' . $chunks[count($chunks) - 1] . ',chunkSplits=' . print_r($chunkSplits, true));
assert(count($chunkSplits) == 3);
// Validate final chunk
* @throws FinalChunkVerificationException If the final chunk does not start with 'EOP:'
*/
public function addAllChunksWithFinal (array $chunks) {
- // Validate final chunk
- if (!$this->isValidFinalChunk($chunks)) {
+ // Try to validate the final chunk
+ try {
+ // Validate final chunk
+ $this->isValidFinalChunk($chunks);
+ } catch (AssertionException $e) {
// Last chunk is not valid
- throw new FinalChunkVerificationException(array($this, $chunks), BaseListener::EXCEPTION_FINAL_CHUNK_VERIFICATION);
- } // END - if
+ throw new FinalChunkVerificationException(array($this, $chunks, $e), BaseListener::EXCEPTION_FINAL_CHUNK_VERIFICATION);
+ }
// Do we have some pending chunks (no final)?
while (!$this->getStackerInstance()->isStackEmpty(self::STACKER_NAME_CHUNKS_WITHOUT_FINAL)) {