Пример #1
0
 public function handle(HttpResponse $response)
 {
     if ($response->getStatusCode() == 404) {
         $response->close();
         throw OSSExceptionFactory::factory()->create(OSSErrorCode::NO_SUCH_KEY, ResourceManager::getInstance()->getString('NoSuchKey'), $response->getHeader(OSSHeaders::OSS_HEADER_REQUEST_ID));
     }
 }
 public function handle(HttpResponse $response)
 {
     if ($response->isSuccess()) {
         return;
     }
     if (!$response->getContent() || $response->getContentLength() <= 0) {
         throw OSSExceptionFactory::factory()->createInvalidResponseException('ServerReturnsUnknownError');
     }
     $error = OSSResponseParserFactory::factory()->createErrorParser()->parse($response, null);
     throw OSSExceptionFactory::factory()->createFromError($error);
 }