Skip to content

Commit

Permalink
Log file path when image open throws exception
Browse files Browse the repository at this point in the history
  • Loading branch information
Patrick McLain committed Jan 11, 2018
1 parent 3d0135f commit 47c497f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion lib/internal/Magento/Framework/Image/Adapter/Gd2.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,10 @@ public function open($filename)
throw new \OverflowException('Memory limit has been reached.');
}
$this->imageDestroy();
$this->_imageHandler = call_user_func($this->_getCallback('create'), $this->_fileName);
$this->_imageHandler = call_user_func(
$this->_getCallback('create', null, sprintf('Unsupported image format. File: %s', $this->_fileName)),
$this->_fileName
);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public function open($filename)
try {
$this->_imageHandler = new \Imagick($this->_fileName);
} catch (\ImagickException $e) {
throw new \Exception('Unsupported image format.', $e->getCode(), $e);
throw new \Exception(sprintf('Unsupported image format. File: %s', $this->_fileName), $e->getCode(), $e);
}

$this->backgroundColor();
Expand Down

0 comments on commit 47c497f

Please sign in to comment.