Skip to content

Commit

Permalink
fix: Export error classes (#2151)
Browse files Browse the repository at this point in the history
* Expose error class

* Expose more error classes

* Expose error codes

---------

Co-authored-by: Lahiru Maramba <llahiru@gmail.com>
  • Loading branch information
IchordeDionysos and lahirumaramba committed May 8, 2024
1 parent 6b558d6 commit bde4308
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/app/index.ts
Expand Up @@ -29,4 +29,6 @@ export { initializeApp, getApp, getApps, deleteApp } from './lifecycle';
export { Credential, ServiceAccount, GoogleOAuthAccessToken } from './credential';
export { applicationDefault, cert, refreshToken } from './credential-factory';

export { FirebaseAppError, AppErrorCodes } from '../utils/error';

export const SDK_VERSION = getSdkVersion();
5 changes: 5 additions & 0 deletions src/auth/index.ts
Expand Up @@ -164,3 +164,8 @@ export {
UserMetadata,
UserRecord,
} from './user-record';

export {
FirebaseAuthError,
AuthClientErrorCode,
} from '../utils/error';
2 changes: 2 additions & 0 deletions src/database/index.ts
Expand Up @@ -125,3 +125,5 @@ function getDatabaseInstance(options: { url?: string; app?: App }): Database {
const dbService = firebaseApp.getOrInitService('database', (app) => new DatabaseService(app));
return dbService.getDatabase(options.url);
}

export { FirebaseDatabaseError } from '../utils/error';
2 changes: 2 additions & 0 deletions src/firestore/index.ts
Expand Up @@ -220,3 +220,5 @@ export function initializeFirestore(

return firestoreService.initializeDatabase(databaseId, settings);
}

export { FirebaseFirestoreError } from '../utils/error';
2 changes: 2 additions & 0 deletions src/installations/index.ts
Expand Up @@ -61,3 +61,5 @@ export function getInstallations(app?: App): Installations {
const firebaseApp: FirebaseApp = app as FirebaseApp;
return firebaseApp.getOrInitService('installations', (app) => new Installations(app));
}

export { FirebaseInstallationsError, InstallationsClientErrorCode } from '../utils/error';
2 changes: 2 additions & 0 deletions src/instance-id/index.ts
Expand Up @@ -70,3 +70,5 @@ export function getInstanceId(app?: App): InstanceId {
const firebaseApp: FirebaseApp = app as FirebaseApp;
return firebaseApp.getOrInitService('instanceId', (app) => new InstanceId(app));
}

export { FirebaseInstanceIdError, InstanceIdClientErrorCode } from '../utils/error';
2 changes: 2 additions & 0 deletions src/messaging/index.ts
Expand Up @@ -100,3 +100,5 @@ export function getMessaging(app?: App): Messaging {
const firebaseApp: FirebaseApp = app as FirebaseApp;
return firebaseApp.getOrInitService('messaging', (app) => new Messaging(app));
}

export { FirebaseMessagingError, MessagingClientErrorCode } from '../utils/error';
2 changes: 2 additions & 0 deletions src/project-management/index.ts
Expand Up @@ -62,3 +62,5 @@ export function getProjectManagement(app?: App): ProjectManagement {
const firebaseApp: FirebaseApp = app as FirebaseApp;
return firebaseApp.getOrInitService('projectManagement', (app) => new ProjectManagement(app));
}

export { FirebaseProjectManagementError, ProjectManagementErrorCode } from '../utils/error';

0 comments on commit bde4308

Please sign in to comment.