File tree 11 files changed +93
-15
lines changed
storage/src/implementation
11 files changed +93
-15
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ " @firebase/firestore " : patch
3
+ " @firebase/storage " : patch
4
+ " @firebase/util " : patch
5
+ ---
6
+
7
+ FirestoreError and StorageError now extend FirebaseError
Original file line number Diff line number Diff line change 6
6
7
7
import { EmulatorMockTokenOptions } from ' @firebase/util' ;
8
8
import { FirebaseApp } from ' @firebase/app' ;
9
+ import { FirebaseError } from ' @firebase/util' ;
9
10
import { LogLevelString as LogLevel } from ' @firebase/logger' ;
10
11
11
12
// @public
@@ -147,10 +148,9 @@ export interface FirestoreDataConverter<T> {
147
148
}
148
149
149
150
// @public
150
- export class FirestoreError extends Error {
151
+ export class FirestoreError extends FirebaseError {
151
152
readonly code: FirestoreErrorCode ;
152
153
readonly message: string ;
153
- readonly name: string ;
154
154
readonly stack? : string ;
155
155
}
156
156
Original file line number Diff line number Diff line change 6
6
7
7
import { EmulatorMockTokenOptions } from ' @firebase/util' ;
8
8
import { FirebaseApp } from ' @firebase/app' ;
9
+ import { FirebaseError } from ' @firebase/util' ;
9
10
import { LogLevelString as LogLevel } from ' @firebase/logger' ;
10
11
11
12
// @public
@@ -177,10 +178,9 @@ export interface FirestoreDataConverter<T> {
177
178
}
178
179
179
180
// @public
180
- export class FirestoreError extends Error {
181
+ export class FirestoreError extends FirebaseError {
181
182
readonly code: FirestoreErrorCode ;
182
183
readonly message: string ;
183
- readonly name: string ;
184
184
readonly stack? : string ;
185
185
}
186
186
Original file line number Diff line number Diff line change 15
15
* limitations under the License.
16
16
*/
17
17
18
+ import { FirebaseError } from '@firebase/util' ;
19
+
18
20
/**
19
21
* The set of Firestore status codes. The codes are the same at the ones
20
22
* exposed by gRPC here:
@@ -208,10 +210,7 @@ export const Code = {
208
210
} ;
209
211
210
212
/** An error returned by a Firestore operation. */
211
- export class FirestoreError extends Error {
212
- /** The custom name for all FirestoreErrors. */
213
- readonly name : string = 'FirebaseError' ;
214
-
213
+ export class FirestoreError extends FirebaseError {
215
214
/** The stack of the error. */
216
215
readonly stack ?: string ;
217
216
@@ -226,7 +225,7 @@ export class FirestoreError extends Error {
226
225
*/
227
226
readonly message : string
228
227
) {
229
- super ( message ) ;
228
+ super ( code , message ) ;
230
229
231
230
// HACK: We write a toString property directly because Error is not a real
232
231
// class and so inheritance does not work correctly. We could alternatively
Original file line number Diff line number Diff line change 1
- import { FirebaseError } from '@firebase/util' ;
2
1
/**
3
2
* @license
4
3
* Copyright 2017 Google LLC
@@ -15,6 +14,9 @@ import { FirebaseError } from '@firebase/util';
15
14
* See the License for the specific language governing permissions and
16
15
* limitations under the License.
17
16
*/
17
+
18
+ import { FirebaseError } from '@firebase/util' ;
19
+
18
20
import { CONFIG_STORAGE_BUCKET_KEY } from './constants' ;
19
21
20
22
/**
Original file line number Diff line number Diff line change @@ -72,11 +72,14 @@ export interface ErrorData {
72
72
// Based on code from:
73
73
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error#Custom_Error_Types
74
74
export class FirebaseError extends Error {
75
+ /** The custom name for all FirebaseErrors. */
75
76
readonly name = ERROR_NAME ;
76
77
77
78
constructor (
79
+ /** The error code for this error. */
78
80
readonly code : string ,
79
81
message : string ,
82
+ /** Custom data for this error. */
80
83
public customData ?: Record < string , unknown >
81
84
) {
82
85
super ( message ) ;
Original file line number Diff line number Diff line change
1
+ <component name =" ProjectRunConfigurationManager" >
2
+ <configuration default =" false" name =" All Tests" type =" mocha-javascript-test-runner" >
3
+ <node-interpreter >project</node-interpreter >
4
+ <node-options />
5
+ <mocha-package >$PROJECT_DIR$/../../node_modules/mocha</mocha-package >
6
+ <working-directory >$PROJECT_DIR$</working-directory >
7
+ <pass-parent-env >true</pass-parent-env >
8
+ <envs >
9
+ <env name =" TS_NODE_COMPILER_OPTIONS" value =" {" module" :" commonjs" }" />
10
+ <env name =" TS_NODE_FILES" value =" true" />
11
+ <env name =" TS_NODE_CACHE" value =" NO" />
12
+ </envs >
13
+ <ui >bdd</ui >
14
+ <extra-mocha-options >--require ts-node/register/type-check</extra-mocha-options >
15
+ <test-kind >PATTERN</test-kind >
16
+ <test-pattern >*.test.ts</test-pattern >
17
+ <method v =" 2" />
18
+ </configuration >
19
+ </component >
Original file line number Diff line number Diff line change @@ -138,7 +138,7 @@ export async function generateApi(
138
138
untrimmedRollupDtsPath : string ,
139
139
publicDtsPath : string
140
140
) : Promise < void > {
141
- console . log ( `Configuring API Extractor for # {packageName}` ) ;
141
+ console . log ( `Configuring API Extractor for $ {packageName } ` ) ;
142
142
writeTypescriptConfig ( packageRoot ) ;
143
143
writePackageJson ( packageName ) ;
144
144
Original file line number Diff line number Diff line change @@ -119,11 +119,15 @@ function isExported(
119
119
sourceFile : ts . SourceFile ,
120
120
name : ts . Identifier
121
121
) : boolean {
122
+ const declarations =
123
+ typeChecker . getSymbolAtLocation ( name ) ?. declarations ?? [ ] ;
124
+
122
125
// Check is this is a public symbol (e.g. part of the DOM library)
123
- const sourceFileNames = typeChecker
124
- . getSymbolAtLocation ( name )
125
- ?. declarations ?. map ( d => d . getSourceFile ( ) . fileName ) ;
126
- if ( sourceFileNames ?. find ( s => s . indexOf ( 'typescript/lib' ) != - 1 ) ) {
126
+ const isTypescriptType = declarations . find (
127
+ d => d . getSourceFile ( ) . fileName . indexOf ( 'typescript/lib' ) != - 1
128
+ ) ;
129
+ const isImported = declarations . find ( d => ts . isImportSpecifier ( d ) ) ;
130
+ if ( isTypescriptType || isImported ) {
127
131
return true ;
128
132
}
129
133
Original file line number Diff line number Diff line change
1
+ /**
2
+ * @license
3
+ * Copyright 2021 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
+ */
17
+ import { FirebaseError } from '@firebase/util' ;
18
+
19
+ export declare interface StorageError extends FirebaseError {
20
+ serverResponse : string | null ;
21
+ }
22
+
23
+ export { } ;
Original file line number Diff line number Diff line change
1
+ /**
2
+ * @license
3
+ * Copyright 2021 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
+ */
17
+ import { FirebaseError } from '@firebase/util' ;
18
+ export declare interface StorageError extends FirebaseError {
19
+ serverResponse : string | null ;
20
+ }
21
+ export { } ;
You can’t perform that action at this time.
0 commit comments