Skip to content

Commit

Permalink
Database throw error instead of reject promise
Browse files Browse the repository at this point in the history
  • Loading branch information
DellaBitta committed Dec 19, 2024
1 parent 037041f commit d6e1917
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions packages/database/src/core/AppCheckTokenProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,9 @@ export class AppCheckTokenProvider {
getToken(forceRefresh?: boolean): Promise<AppCheckTokenResult> {
if (this.serverAppAppCheckToken) {
if (forceRefresh) {
return new Promise<AppCheckTokenResult>(resolve => {
const appCheckTokenResult = {
token: 'ERROR',
error: new Error(
'Attempted reuse of FirebaseServerApp.appCheckToken after previous usage failed.'
)
};
resolve(appCheckTokenResult);
});
throw new Error(
'Attempted reuse of `FirebaseServerApp.appCheckToken` after previous usage failed.'
);
}
return Promise.resolve({ token: this.serverAppAppCheckToken });
}
Expand Down

0 comments on commit d6e1917

Please sign in to comment.