UNPKG

2.14 kBTypeScriptView Raw
1/**
2 * @license
3 * Copyright 2019 Google LLC
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17import { ErrorFactory } from '@firebase/util';
18export declare const enum ErrorCode {
19 REGISTRATION_WINDOW = "registration-window",
20 REGISTRATION_PROJECT_ID = "registration-project-id",
21 REGISTRATION_API_KEY = "registration-api-key",
22 REGISTRATION_APP_ID = "registration-app-id",
23 STORAGE_OPEN = "storage-open",
24 STORAGE_GET = "storage-get",
25 STORAGE_SET = "storage-set",
26 STORAGE_DELETE = "storage-delete",
27 FETCH_NETWORK = "fetch-client-network",
28 FETCH_TIMEOUT = "fetch-timeout",
29 FETCH_THROTTLE = "fetch-throttle",
30 FETCH_PARSE = "fetch-client-parse",
31 FETCH_STATUS = "fetch-status"
32}
33interface ErrorParams {
34 [ErrorCode.STORAGE_OPEN]: {
35 originalErrorMessage: string | undefined;
36 };
37 [ErrorCode.STORAGE_GET]: {
38 originalErrorMessage: string | undefined;
39 };
40 [ErrorCode.STORAGE_SET]: {
41 originalErrorMessage: string | undefined;
42 };
43 [ErrorCode.STORAGE_DELETE]: {
44 originalErrorMessage: string | undefined;
45 };
46 [ErrorCode.FETCH_NETWORK]: {
47 originalErrorMessage: string;
48 };
49 [ErrorCode.FETCH_THROTTLE]: {
50 throttleEndTimeMillis: number;
51 };
52 [ErrorCode.FETCH_PARSE]: {
53 originalErrorMessage: string;
54 };
55 [ErrorCode.FETCH_STATUS]: {
56 httpStatus: number;
57 };
58}
59export declare const ERROR_FACTORY: ErrorFactory<ErrorCode, ErrorParams>;
60export declare function hasErrorCode(e: Error, errorCode: ErrorCode): boolean;
61export {};