Skip to content

Commit 332cf31

Browse files
committed
Added comments and fixed typings
1 parent 2312460 commit 332cf31

File tree

2 files changed

+54
-2
lines changed

2 files changed

+54
-2
lines changed

packages/firebase/compat/index.d.ts

Lines changed: 52 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8017,11 +8017,61 @@ declare namespace firebase.storage {
80178017
md5Hash?: string | null;
80188018
}
80198019

8020+
/**
8021+
* @public
8022+
* Error codes that can be attached to `StorageError`s.
8023+
*/
8024+
export enum StorageErrorCode {
8025+
UNKNOWN = 'unknown',
8026+
OBJECT_NOT_FOUND = 'object-not-found',
8027+
BUCKET_NOT_FOUND = 'bucket-not-found',
8028+
PROJECT_NOT_FOUND = 'project-not-found',
8029+
QUOTA_EXCEEDED = 'quota-exceeded',
8030+
UNAUTHENTICATED = 'unauthenticated',
8031+
UNAUTHORIZED = 'unauthorized',
8032+
UNAUTHORIZED_APP = 'unauthorized-app',
8033+
RETRY_LIMIT_EXCEEDED = 'retry-limit-exceeded',
8034+
INVALID_CHECKSUM = 'invalid-checksum',
8035+
CANCELED = 'canceled',
8036+
INVALID_EVENT_NAME = 'invalid-event-name',
8037+
INVALID_URL = 'invalid-url',
8038+
INVALID_DEFAULT_BUCKET = 'invalid-default-bucket',
8039+
NO_DEFAULT_BUCKET = 'no-default-bucket',
8040+
CANNOT_SLICE_BLOB = 'cannot-slice-blob',
8041+
SERVER_FILE_WRONG_SIZE = 'server-file-wrong-size',
8042+
NO_DOWNLOAD_URL = 'no-download-url',
8043+
INVALID_ARGUMENT = 'invalid-argument',
8044+
INVALID_ARGUMENT_COUNT = 'invalid-argument-count',
8045+
APP_DELETED = 'app-deleted',
8046+
INVALID_ROOT_OPERATION = 'invalid-root-operation',
8047+
INVALID_FORMAT = 'invalid-format',
8048+
INTERNAL_ERROR = 'internal-error',
8049+
UNSUPPORTED_ENVIRONMENT = 'unsupported-environment'
8050+
}
8051+
80208052
/**
80218053
* An error returned by the Firebase Storage SDK.
8054+
* @public
80228055
*/
8023-
interface FirebaseStorageError extends FirebaseError {
8024-
serverResponse: string | null;
8056+
export interface FirebaseStorageError extends FirebaseError {
8057+
/**
8058+
* Stores custom error data unque to StorageError.
8059+
*/
8060+
customData: {
8061+
serverResponse: string | null;
8062+
};
8063+
8064+
get status(): number;
8065+
set status(status: number);
8066+
/**
8067+
* Compares a StorageErrorCode against this error's code, filtering out the prefix.
8068+
*/
8069+
_codeEquals(code: StorageErrorCode): boolean;
8070+
/**
8071+
* Optional response message that was added by the server.
8072+
*/
8073+
get serverResponse(): null | string;
8074+
set serverResponse(serverResponse: string | null);
80258075
}
80268076

80278077
interface StorageObserver<T> {

packages/storage-types/index.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ export interface StorageObserver<T> {
9696
error?: (error: FirebaseStorageError) => void | null;
9797
complete?: CompleteFn | null;
9898
}
99+
99100
export enum StorageErrorCode {
100101
UNKNOWN = 'unknown',
101102
OBJECT_NOT_FOUND = 'object-not-found',
@@ -123,6 +124,7 @@ export enum StorageErrorCode {
123124
INTERNAL_ERROR = 'internal-error',
124125
UNSUPPORTED_ENVIRONMENT = 'unsupported-environment'
125126
}
127+
126128
export interface FirebaseStorageError extends FirebaseError {
127129
/**
128130
* Stores custom error data unque to StorageError.

0 commit comments

Comments
 (0)