@@ 73-91 (lines=19) @@ | ||
70 | * |
|
71 | * @throws \RuntimeException if cannot create the container |
|
72 | */ |
|
73 | public function createContainer($containerName, CreateContainerOptions $options = null) |
|
74 | { |
|
75 | $this->init(); |
|
76 | ||
77 | try { |
|
78 | $this->blobProxy->createContainer($containerName, $options); |
|
79 | } catch (ServiceException $e) { |
|
80 | $errorCode = $this->getErrorCodeFromServiceException($e); |
|
81 | ||
82 | if ($errorCode != self::ERROR_CONTAINER_ALREADY_EXISTS) { |
|
83 | throw new \RuntimeException(sprintf( |
|
84 | 'Failed to create the configured container "%s": %s (%s).', |
|
85 | $containerName, |
|
86 | $e->getErrorText(), |
|
87 | $errorCode |
|
88 | )); |
|
89 | } |
|
90 | } |
|
91 | } |
|
92 | ||
93 | /** |
|
94 | * Deletes a container. |
|
@@ 101-119 (lines=19) @@ | ||
98 | * |
|
99 | * @throws \RuntimeException if cannot delete the container |
|
100 | */ |
|
101 | public function deleteContainer($containerName, DeleteContainerOptions $options = null) |
|
102 | { |
|
103 | $this->init(); |
|
104 | ||
105 | try { |
|
106 | $this->blobProxy->deleteContainer($containerName, $options); |
|
107 | } catch (ServiceException $e) { |
|
108 | $errorCode = $this->getErrorCodeFromServiceException($e); |
|
109 | ||
110 | if ($errorCode != self::ERROR_CONTAINER_NOT_FOUND) { |
|
111 | throw new \RuntimeException(sprintf( |
|
112 | 'Failed to delete the configured container "%s": %s (%s).', |
|
113 | $containerName, |
|
114 | $e->getErrorText(), |
|
115 | $errorCode |
|
116 | ), $e->getCode()); |
|
117 | } |
|
118 | } |
|
119 | } |
|
120 | ||
121 | /** |
|
122 | * {@inheritdoc} |