Skip to content

Commit 922e9ed

Browse files
authored
[Auth] Fix error code thrown when the network errors out (#5892)
* Fix error code thrown when the network errors out * Add changeset
1 parent 88d43ec commit 922e9ed

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

.changeset/moody-ways-learn.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@firebase/auth": patch
3+
---
4+
5+
Fix error code thrown when the network times out

packages/auth/src/api/index.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ describe('api/_performApiRequest', () => {
316316
request
317317
);
318318
clock.tick(DEFAULT_API_TIMEOUT_MS.get() + 1);
319-
await expect(promise).to.be.rejectedWith(FirebaseError, 'auth/timeout');
319+
await expect(promise).to.be.rejectedWith(FirebaseError, 'auth/network-request-failed');
320320
clock.restore();
321321
});
322322

packages/auth/src/api/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ class NetworkTimeout<T> {
223223
private timer: any | null = null;
224224
readonly promise = new Promise<T>((_, reject) => {
225225
this.timer = setTimeout(() => {
226-
return reject(_createError(this.auth, AuthErrorCode.TIMEOUT));
226+
return reject(_createError(this.auth, AuthErrorCode.NETWORK_REQUEST_FAILED));
227227
}, DEFAULT_API_TIMEOUT_MS.get());
228228
});
229229

0 commit comments

Comments
 (0)