Skip to content

Commit 8ff851c

Browse files
committed
Rename message to errorInfo in errors
1 parent 46213bb commit 8ff851c

File tree

3 files changed

+22
-21
lines changed

3 files changed

+22
-21
lines changed

packages/messaging/src/controllers/sw-controller.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ export class SwController extends BaseController {
136136
registration = await this.getSWRegistration_();
137137
} catch (err) {
138138
throw errorFactory.create(ErrorCode.UNABLE_TO_RESUBSCRIBE, {
139-
message: err
139+
errorInfo: err
140140
});
141141
}
142142

packages/messaging/src/models/errors.ts

+18-17
Original file line numberDiff line numberDiff line change
@@ -63,16 +63,16 @@ export const ERROR_MAP: ErrorMap<ErrorCode> = {
6363
[ErrorCode.AVAILABLE_IN_WINDOW]:
6464
'This method is available in a Window context.',
6565
[ErrorCode.AVAILABLE_IN_SW]:
66-
'This method is available in a service worker ' + 'context.',
66+
'This method is available in a service worker context.',
6767
[ErrorCode.SHOULD_BE_INHERITED]:
68-
'This method should be overriden by ' + 'extended classes.',
68+
'This method should be overriden by extended classes.',
6969
[ErrorCode.BAD_SENDER_ID]:
7070
"Please ensure that 'messagingSenderId' is set " +
7171
'correctly in the options passed into firebase.initializeApp().',
7272
[ErrorCode.PERMISSION_DEFAULT]:
73-
'The required permissions were not granted and ' + 'dismissed instead.',
73+
'The required permissions were not granted and dismissed instead.',
7474
[ErrorCode.PERMISSION_BLOCKED]:
75-
'The required permissions were not granted and ' + 'blocked instead.',
75+
'The required permissions were not granted and blocked instead.',
7676
[ErrorCode.UNSUPPORTED_BROWSER]:
7777
"This browser doesn't support the API's " +
7878
'required to use the firebase SDK.',
@@ -81,26 +81,27 @@ export const ERROR_MAP: ErrorMap<ErrorCode> = {
8181
'We are unable to register the ' +
8282
'default service worker. {$browserErrorMessage}',
8383
[ErrorCode.SW_REGISTRATION_EXPECTED]:
84-
'A service worker registration was the ' + 'expected input.',
84+
'A service worker registration was the expected input.',
8585
[ErrorCode.GET_SUBSCRIPTION_FAILED]:
8686
'There was an error when trying to get ' +
8787
'any existing Push Subscriptions.',
8888
[ErrorCode.INVALID_SAVED_TOKEN]:
8989
'Unable to access details of the saved token.',
9090
[ErrorCode.SW_REG_REDUNDANT]:
91-
'The service worker being used for push was made ' + 'redundant.',
91+
'The service worker being used for push was made redundant.',
9292
[ErrorCode.TOKEN_SUBSCRIBE_FAILED]:
93-
'A problem occured while subscribing the ' + 'user to FCM: {$message}',
93+
'A problem occured while subscribing the user to FCM: {$errorInfo}',
9494
[ErrorCode.TOKEN_SUBSCRIBE_NO_TOKEN]:
95-
'FCM returned no token when subscribing ' + 'the user to push.',
95+
'FCM returned no token when subscribing the user to push.',
9696
[ErrorCode.TOKEN_SUBSCRIBE_NO_PUSH_SET]:
97-
'FCM returned an invalid response ' + 'when getting an FCM token.',
97+
'FCM returned an invalid response when getting an FCM token.',
9898
[ErrorCode.TOKEN_UNSUBSCRIBE_FAILED]:
99-
'A problem occured while unsubscribing the ' + 'user from FCM: {$message}',
99+
'A problem occured while unsubscribing the ' +
100+
'user from FCM: {$errorInfo}',
100101
[ErrorCode.TOKEN_UPDATE_FAILED]:
101-
'A problem occured while updating the ' + 'user from FCM: {$message}',
102+
'A problem occured while updating the user from FCM: {$errorInfo}',
102103
[ErrorCode.TOKEN_UPDATE_NO_TOKEN]:
103-
'FCM returned no token when updating ' + 'the user to push.',
104+
'FCM returned no token when updating the user to push.',
104105
[ErrorCode.USE_SW_BEFORE_GET_TOKEN]:
105106
'The useServiceWorker() method may only be called once and must be ' +
106107
'called before calling getToken() to ensure your service worker is used.',
@@ -114,13 +115,13 @@ export const ERROR_MAP: ErrorMap<ErrorCode> = {
114115
'The deletion attempt for service worker ' +
115116
'scope could not be performed as the scope was not found.',
116117
[ErrorCode.BG_HANDLER_FUNCTION_EXPECTED]:
117-
'The input to ' + 'setBackgroundMessageHandler() must be a function.',
118+
'The input to setBackgroundMessageHandler() must be a function.',
118119
[ErrorCode.NO_WINDOW_CLIENT_TO_MSG]:
119-
'An attempt was made to message a ' + 'non-existant window client.',
120+
'An attempt was made to message a non-existant window client.',
120121
[ErrorCode.UNABLE_TO_RESUBSCRIBE]:
121122
'There was an error while re-subscribing ' +
122123
'the FCM token for push messaging. Will have to resubscribe the ' +
123-
'user on next visit. {$message}',
124+
'user on next visit. {$errorInfo}',
124125
[ErrorCode.NO_FCM_TOKEN_FOR_RESUBSCRIBE]:
125126
'Could not find an FCM token ' +
126127
'and as a result, unable to resubscribe. Will have to resubscribe the ' +
@@ -139,7 +140,7 @@ export const ERROR_MAP: ErrorMap<ErrorCode> = {
139140
[ErrorCode.BAD_VAPID_KEY]:
140141
'The public VAPID key is not a Uint8Array with 65 bytes.',
141142
[ErrorCode.BAD_SUBSCRIPTION]:
142-
'The subscription must be a valid ' + 'PushSubscription.',
143+
'The subscription must be a valid PushSubscription.',
143144
[ErrorCode.BAD_TOKEN]:
144145
'The FCM Token used for storage / lookup was not ' +
145146
'a valid token string.',
@@ -153,7 +154,7 @@ export const ERROR_MAP: ErrorMap<ErrorCode> = {
153154
'The usePublicVapidKey() method may only be called once and must be ' +
154155
'called before calling getToken() to ensure your VAPID key is used.',
155156
[ErrorCode.PUBLIC_KEY_DECRYPTION_FAILED]:
156-
'The public VAPID key did not equal ' + '65 bytes when decrypted.'
157+
'The public VAPID key did not equal 65 bytes when decrypted.'
157158
};
158159

159160
export const errorFactory = new ErrorFactory(

packages/messaging/src/models/iid-model.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ export class IidModel {
7878
if (responseData.error) {
7979
const message = responseData.error.message;
8080
throw errorFactory.create(ErrorCode.TOKEN_SUBSCRIBE_FAILED, {
81-
message: message
81+
errorInfo: message
8282
});
8383
}
8484

@@ -150,7 +150,7 @@ export class IidModel {
150150
if (responseData.error) {
151151
const message = responseData.error.message;
152152
throw errorFactory.create(ErrorCode.TOKEN_UPDATE_FAILED, {
153-
message: message
153+
errorInfo: message
154154
});
155155
}
156156

@@ -192,7 +192,7 @@ export class IidModel {
192192
if (responseData.error) {
193193
const message = responseData.error.message;
194194
throw errorFactory.create(ErrorCode.TOKEN_UNSUBSCRIBE_FAILED, {
195-
message: message
195+
errorInfo: message
196196
});
197197
}
198198
} catch (err) {

0 commit comments

Comments
 (0)