Skip to content

Commit 41382ed

Browse files
committed
error updates
1 parent 147771a commit 41382ed

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

packages/installations/src/api/get-id.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ import { ERROR_FACTORY, ErrorCode } from '../util/errors';
3232
export async function getId(installations: Installations): Promise<string> {
3333
if (_isFirebaseServerApp(installations.app)) {
3434
if (!installations.app.installationsId) {
35-
throw ERROR_FACTORY.create(ErrorCode.SERVER_APP_MISSING_AUTH_TOKEN);
35+
throw ERROR_FACTORY.create(
36+
ErrorCode.SERVER_APP_MISSING_INSTALLATIONS_AUTH_TOKEN
37+
);
3638
}
3739
return installations.app.installationsId;
3840
}

packages/installations/src/api/get-token.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,10 @@ export async function getToken(
3535
forceRefresh = false
3636
): Promise<string> {
3737
if (_isFirebaseServerApp(installations.app)) {
38-
if (installations.app.installationsAuthToken === undefined) {
39-
throw ERROR_FACTORY.create(ErrorCode.SERVER_APP_MISSING_AUTH_TOKEN);
38+
if (!installations.app.installationsAuthToken) {
39+
throw ERROR_FACTORY.create(
40+
ErrorCode.SERVER_APP_MISSING_INSTALLATIONS_AUTH_TOKEN
41+
);
4042
}
4143
return installations.app.installationsAuthToken;
4244
}

packages/installations/src/util/errors.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export const enum ErrorCode {
2525
REQUEST_FAILED = 'request-failed',
2626
APP_OFFLINE = 'app-offline',
2727
DELETE_PENDING_REGISTRATION = 'delete-pending-registration',
28-
SERVER_APP_MISSING_AUTH_TOKEN = 'server-app-missing-auth-token'
28+
SERVER_APP_MISSING_INSTALLATIONS_AUTH_TOKEN = 'server-app-missing-installatoins-auth-token'
2929
}
3030

3131
const ERROR_DESCRIPTION_MAP: { readonly [key in ErrorCode]: string } = {
@@ -38,7 +38,7 @@ const ERROR_DESCRIPTION_MAP: { readonly [key in ErrorCode]: string } = {
3838
[ErrorCode.APP_OFFLINE]: 'Could not process request. Application offline.',
3939
[ErrorCode.DELETE_PENDING_REGISTRATION]:
4040
"Can't delete installation while there is a pending registration request.",
41-
[ErrorCode.SERVER_APP_MISSING_AUTH_TOKEN]:
41+
[ErrorCode.SERVER_APP_MISSING_INSTALLATIONS_AUTH_TOKEN]:
4242
'The instance of FirebaseServerApp was not initialized with a valid installationsAuthToken'
4343
};
4444

0 commit comments

Comments
 (0)