| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "config.h" | 5 #include "config.h" |
| 6 #include "modules/cachestorage/CacheStorageError.h" | 6 #include "modules/cachestorage/CacheStorageError.h" |
| 7 | 7 |
| 8 #include "core/dom/DOMException.h" | 8 #include "core/dom/DOMException.h" |
| 9 #include "core/dom/ExceptionCode.h" | 9 #include "core/dom/ExceptionCode.h" |
| 10 #include "modules/cachestorage/Cache.h" | 10 #include "modules/cachestorage/Cache.h" |
| 11 #include "public/platform/WebServiceWorkerCacheError.h" | 11 #include "public/platform/WebServiceWorkerCacheError.h" |
| 12 | 12 |
| 13 namespace blink { | 13 namespace blink { |
| 14 | 14 |
| 15 DOMException* CacheStorageError::take(ScriptPromiseResolver*, PassOwnPtr<WebType
> webError) | 15 DOMException* CacheStorageError::take(ScriptPromiseResolver*, PassOwnPtr<WebServ
iceWorkerCacheError> webError) |
| 16 { | 16 { |
| 17 return CacheStorageError::createException(*webError); | 17 return CacheStorageError::createException(*webError); |
| 18 } | 18 } |
| 19 | 19 |
| 20 DOMException* CacheStorageError::createException(WebType webError) | 20 DOMException* CacheStorageError::createException(WebServiceWorkerCacheError webE
rror) |
| 21 { | 21 { |
| 22 switch (webError) { | 22 switch (webError) { |
| 23 case WebServiceWorkerCacheErrorNotImplemented: | 23 case WebServiceWorkerCacheErrorNotImplemented: |
| 24 return DOMException::create(NotSupportedError, "Method is not implemente
d."); | 24 return DOMException::create(NotSupportedError, "Method is not implemente
d."); |
| 25 case WebServiceWorkerCacheErrorNotFound: | 25 case WebServiceWorkerCacheErrorNotFound: |
| 26 return DOMException::create(NotFoundError, "Entry was not found."); | 26 return DOMException::create(NotFoundError, "Entry was not found."); |
| 27 case WebServiceWorkerCacheErrorExists: | 27 case WebServiceWorkerCacheErrorExists: |
| 28 return DOMException::create(InvalidAccessError, "Entry already exists.")
; | 28 return DOMException::create(InvalidAccessError, "Entry already exists.")
; |
| 29 default: | 29 default: |
| 30 ASSERT_NOT_REACHED(); | 30 ASSERT_NOT_REACHED(); |
| 31 return DOMException::create(NotSupportedError, "Unknown error."); | 31 return DOMException::create(NotSupportedError, "Unknown error."); |
| 32 } | 32 } |
| 33 } | 33 } |
| 34 | 34 |
| 35 } // namespace blink | 35 } // namespace blink |
| OLD | NEW |