CouldNotCreateChecksumException.php 1.0 KB

12345678910111213141516171819202122232425
  1. <?php
  2. namespace Aws\Exception;
  3. use Aws\HasMonitoringEventsTrait;
  4. use Aws\MonitoringEventsInterface;
  5. class CouldNotCreateChecksumException extends \RuntimeException implements
  6. MonitoringEventsInterface
  7. {
  8. use HasMonitoringEventsTrait;
  9. public function __construct($algorithm, \Exception $previous = null)
  10. {
  11. $prefix = $algorithm === 'md5' ? "An" : "A";
  12. parent::__construct("{$prefix} {$algorithm} checksum could not be "
  13. . "calculated for the provided upload body, because it was not "
  14. . "seekable. To prevent this error you can either 1) include the "
  15. . "ContentMD5 or ContentSHA256 parameters with your request, 2) "
  16. . "use a seekable stream for the body, or 3) wrap the non-seekable "
  17. . "stream in a GuzzleHttp\\Psr7\\CachingStream object. You "
  18. . "should be careful though and remember that the CachingStream "
  19. . "utilizes PHP temp streams. This means that the stream will be "
  20. . "temporarily stored on the local disk.", 0, $previous);
  21. }
  22. }