Skip to content

Commit 385d8bd

Browse files
committed
Update the errorcodes
1 parent 494af7d commit 385d8bd

File tree

2 files changed

+9
-14
lines changed

2 files changed

+9
-14
lines changed

packages/remote-config/src/client/realtime_handler.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -452,10 +452,6 @@ export class RealtimeHandler {
452452
private async handleNotifications(
453453
reader: ReadableStreamDefaultReader<Uint8Array>
454454
): Promise<void> {
455-
if (reader == null) {
456-
return;
457-
}
458-
459455
let partialConfigUpdateMessage: string;
460456
let currentConfigUpdateMessage = '';
461457

@@ -618,7 +614,8 @@ export class RealtimeHandler {
618614
// Update backoff metadata if the connection failed in the foreground.
619615
const connectionFailed =
620616
!this.isInBackground &&
621-
(responseCode == null || this.isStatusCodeRetryable(responseCode));
617+
(responseCode === undefined ||
618+
this.isStatusCodeRetryable(responseCode));
622619

623620
if (connectionFailed) {
624621
await this.updateBackoffMetadataWithLastFailedStreamConnectionTime(
@@ -633,7 +630,6 @@ export class RealtimeHandler {
633630
const firebaseError = ERROR_FACTORY.create(
634631
ErrorCode.CONFIG_UPDATE_STREAM_ERROR,
635632
{
636-
httpStatus: responseCode,
637633
originalErrorMessage: errorMessage
638634
}
639635
);

packages/remote-config/src/errors.ts

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,13 @@ const ERROR_DESCRIPTION_MAP: { readonly [key in ErrorCode]: string } = {
7878
[ErrorCode.CUSTOM_SIGNAL_MAX_ALLOWED_SIGNALS]:
7979
'Setting more than {$maxSignals} custom signals is not supported.',
8080
[ErrorCode.CONFIG_UPDATE_STREAM_ERROR]:
81-
'The stream was not able to connect to the backend.',
82-
[ErrorCode.CONFIG_UPDATE_UNAVAILABLE]: 'The Realtime service is unavailable.',
81+
'The stream was not able to connect to the backend: {$originalErrorMessage}.',
82+
[ErrorCode.CONFIG_UPDATE_UNAVAILABLE]:
83+
'The Realtime service is unavailable: {$originalErrorMessage}',
8384
[ErrorCode.CONFIG_UPDATE_MESSAGE_INVALID]:
84-
'The stream invalidation message was unparsable.',
85-
[ErrorCode.CONFIG_UPDATE_NOT_FETCHED]: 'Unable to fetch the latest config.'
85+
'The stream invalidation message was unparsable: {$originalErrorMessage}',
86+
[ErrorCode.CONFIG_UPDATE_NOT_FETCHED]:
87+
'Unable to fetch the latest config: {$originalErrorMessage}'
8688
};
8789

8890
// Note this is effectively a type system binding a code to params. This approach overlaps with the
@@ -102,10 +104,7 @@ interface ErrorParams {
102104
[ErrorCode.FETCH_PARSE]: { originalErrorMessage: string };
103105
[ErrorCode.FETCH_STATUS]: { httpStatus: number };
104106
[ErrorCode.CUSTOM_SIGNAL_MAX_ALLOWED_SIGNALS]: { maxSignals: number };
105-
[ErrorCode.CONFIG_UPDATE_STREAM_ERROR]: {
106-
httpStatus?: number;
107-
originalErrorMessage?: string;
108-
};
107+
[ErrorCode.CONFIG_UPDATE_STREAM_ERROR]: { originalErrorMessage?: string };
109108
[ErrorCode.CONFIG_UPDATE_UNAVAILABLE]: { originalErrorMessage: string };
110109
[ErrorCode.CONFIG_UPDATE_MESSAGE_INVALID]: { originalErrorMessage: string };
111110
[ErrorCode.CONFIG_UPDATE_NOT_FETCHED]: { originalErrorMessage: string };

0 commit comments

Comments
 (0)