blob: ba33b7a5731350b231b7a04363f08aa9875e936b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "modules/push_messaging/PushError.h"
#include "core/dom/DOMException.h"
#include "core/dom/ExceptionCode.h"
namespace blink {
DOMException* PushError::take(ScriptPromiseResolver*, const WebPushError& webError)
{
switch (webError.errorType) {
case WebPushError::ErrorTypeAbort:
return DOMException::create(AbortError, webError.message);
case WebPushError::ErrorTypeNetwork:
return DOMException::create(NetworkError, webError.message);
case WebPushError::ErrorTypeNotFound:
return DOMException::create(NotFoundError, webError.message);
case WebPushError::ErrorTypeNotSupported:
return DOMException::create(NotSupportedError, webError.message);
case WebPushError::ErrorTypePermissionDenied:
return DOMException::create(PermissionDeniedError, webError.message);
case WebPushError::ErrorTypeUnknown:
return DOMException::create(UnknownError, webError.message);
}
ASSERT_NOT_REACHED();
return DOMException::create(UnknownError);
}
} // namespace blink
|