Skip to content

Commit f3810d8

Browse files
committed
Check if network error is propagated in error message
1 parent 3813804 commit f3810d8

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

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

+6-4
Original file line numberDiff line numberDiff line change
@@ -358,10 +358,12 @@ describe('api/_performApiRequest', () => {
358358
Endpoint.SIGN_UP,
359359
request
360360
);
361-
await expect(promise).to.be.rejectedWith(
362-
FirebaseError,
363-
'auth/network-request-failed'
364-
);
361+
await expect(promise)
362+
.to.be.rejectedWith(FirebaseError, 'auth/network-request-failed')
363+
.eventually.with.nested.property(
364+
'customData.message',
365+
'Error: network error'
366+
);
365367
});
366368
});
367369

packages/auth/src/api/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ export async function _performFetchWithErrorHandling<V>(
183183
}
184184
// Changing this to a different error code will log user out when there is a network error
185185
// because we treat any error other than NETWORK_REQUEST_FAILED as token is invalid.
186-
// https://github.com/firebase/firebase-js-sdk/blob/master/packages/auth/src/core/auth/auth_impl.ts#L309-L316
186+
// https://github.com/firebase/firebase-js-sdk/blob/4fbc73610d70be4e0852e7de63a39cb7897e8546/packages/auth/src/core/auth/auth_impl.ts#L309-L316
187187
_fail(auth, AuthErrorCode.NETWORK_REQUEST_FAILED, { 'message': String(e) });
188188
}
189189
}

0 commit comments

Comments
 (0)