Skip to content

Commit

Permalink
[Auth] Fix error code thrown when the network errors out (#5892)
Browse files Browse the repository at this point in the history
* Fix error code thrown when the network errors out

* Add changeset
  • Loading branch information
sam-gc authored Jan 14, 2022
1 parent 88d43ec commit 922e9ed
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/moody-ways-learn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@firebase/auth": patch
---

Fix error code thrown when the network times out
2 changes: 1 addition & 1 deletion packages/auth/src/api/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ describe('api/_performApiRequest', () => {
request
);
clock.tick(DEFAULT_API_TIMEOUT_MS.get() + 1);
await expect(promise).to.be.rejectedWith(FirebaseError, 'auth/timeout');
await expect(promise).to.be.rejectedWith(FirebaseError, 'auth/network-request-failed');
clock.restore();
});

Expand Down
2 changes: 1 addition & 1 deletion packages/auth/src/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ class NetworkTimeout<T> {
private timer: any | null = null;
readonly promise = new Promise<T>((_, reject) => {
this.timer = setTimeout(() => {
return reject(_createError(this.auth, AuthErrorCode.TIMEOUT));
return reject(_createError(this.auth, AuthErrorCode.NETWORK_REQUEST_FAILED));
}, DEFAULT_API_TIMEOUT_MS.get());
});

Expand Down

0 comments on commit 922e9ed

Please sign in to comment.