1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "content/common/service_worker/service_worker_status_code.h"
7 #include "base/logging.h"
11 const char* ServiceWorkerStatusToString(ServiceWorkerStatusCode status
) {
13 case SERVICE_WORKER_OK
:
14 return "Operation has succeeded";
15 case SERVICE_WORKER_ERROR_FAILED
:
16 return "Operation has failed (unknown reason)";
17 case SERVICE_WORKER_ERROR_ABORT
:
18 return "Operation has been aborted";
19 case SERVICE_WORKER_ERROR_PROCESS_NOT_FOUND
:
20 return "Could not find a renderer process to run a service worker";
21 case SERVICE_WORKER_ERROR_NOT_FOUND
:
23 case SERVICE_WORKER_ERROR_EXISTS
:
24 return "Already exists";
25 case SERVICE_WORKER_ERROR_START_WORKER_FAILED
:
26 return "ServiceWorker cannot be started";
27 case SERVICE_WORKER_ERROR_INSTALL_WORKER_FAILED
:
28 return "ServiceWorker failed to install";
29 case SERVICE_WORKER_ERROR_ACTIVATE_WORKER_FAILED
:
30 return "ServiceWorker failed to activate";
31 case SERVICE_WORKER_ERROR_IPC_FAILED
:
32 return "IPC connection was closed or IPC error has occured";
33 case SERVICE_WORKER_ERROR_NETWORK
:
34 return "Operation failed by network issue";
35 case SERVICE_WORKER_ERROR_SECURITY
:
36 return "Operation failed by security issue";
37 case SERVICE_WORKER_ERROR_EVENT_WAITUNTIL_REJECTED
:
38 return "ServiceWorker failed to handle event (event.waitUntil "
40 case SERVICE_WORKER_ERROR_STATE
:
41 return "The ServiceWorker state was not valid";
42 case SERVICE_WORKER_ERROR_TIMEOUT
:
43 return "The ServiceWorker timed out";
44 case SERVICE_WORKER_ERROR_SCRIPT_EVALUATE_FAILED
:
45 return "ServiceWorker script evaluation failed";
46 case SERVICE_WORKER_ERROR_DISK_CACHE
:
47 return "Disk cache error";
48 case SERVICE_WORKER_ERROR_REDUNDANT
:
49 return "Redundant worker";
50 case SERVICE_WORKER_ERROR_DISALLOWED
:
51 return "Worker disallowed";
52 case SERVICE_WORKER_ERROR_MAX_VALUE
:
59 } // namespace content