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