@@ -20,7 +20,7 @@ import * as validator from '../utils/validator';
2020import { App } from '../app/index' ;
2121import { FirebaseApp } from '../app/firebase-app' ;
2222import { deepCopy , deepExtend } from '../utils/deep-copy' ;
23- import { AuthClientErrorCode , FirebaseAuthError } from '../utils/error' ;
23+ import { AuthClientErrorCode , FirebaseAuthError , toHttpResponse } from '../utils/error' ;
2424import {
2525 ApiSettings , AuthorizedHttpClient , HttpRequestConfig , RequestResponseError , RequestResponse ,
2626} from '../utils/api-request' ;
@@ -591,7 +591,7 @@ export const FIREBASE_AUTH_CREATE_SESSION_COOKIE =
591591 if ( ! validator . isNonEmptyString ( response . data ?. sessionCookie ) ) {
592592 throw new FirebaseAuthError ( {
593593 ...AuthClientErrorCode . INTERNAL_ERROR ,
594- httpResponse : response ,
594+ httpResponse : toHttpResponse ( response ) ,
595595 } ) ;
596596 }
597597 } ) ;
@@ -660,7 +660,7 @@ export const FIREBASE_AUTH_GET_ACCOUNT_INFO = new ApiSettings('/accounts:lookup'
660660 if ( ! data . users || ! data . users . length ) {
661661 throw new FirebaseAuthError ( {
662662 ...AuthClientErrorCode . USER_NOT_FOUND ,
663- httpResponse : response ,
663+ httpResponse : toHttpResponse ( response ) ,
664664 } ) ;
665665 }
666666 } ) ;
@@ -736,14 +736,14 @@ export const FIREBASE_AUTH_BATCH_DELETE_ACCOUNTS = new ApiSettings('/accounts:ba
736736 throw new FirebaseAuthError ( {
737737 ...AuthClientErrorCode . INTERNAL_ERROR ,
738738 message : 'INTERNAL ASSERT FAILED: Server BatchDeleteAccountResponse is missing an errors.index field' ,
739- httpResponse : response ,
739+ httpResponse : toHttpResponse ( response ) ,
740740 } ) ;
741741 }
742742 if ( ! batchDeleteErrorInfo . localId ) {
743743 throw new FirebaseAuthError ( {
744744 ...AuthClientErrorCode . INTERNAL_ERROR ,
745745 message : 'INTERNAL ASSERT FAILED: Server BatchDeleteAccountResponse is missing an errors.localId field' ,
746- httpResponse : response ,
746+ httpResponse : toHttpResponse ( response ) ,
747747 } ) ;
748748 }
749749 // Allow the (error) message to be missing/undef.
@@ -779,7 +779,7 @@ export const FIREBASE_AUTH_SET_ACCOUNT_INFO = new ApiSettings('/accounts:update'
779779 if ( ! data ?. localId ) {
780780 throw new FirebaseAuthError ( {
781781 ...AuthClientErrorCode . USER_NOT_FOUND ,
782- httpResponse : response ,
782+ httpResponse : toHttpResponse ( response ) ,
783783 } ) ;
784784 }
785785 } ) ;
@@ -823,7 +823,7 @@ export const FIREBASE_AUTH_SIGN_UP_NEW_USER = new ApiSettings('/accounts', 'POST
823823 throw new FirebaseAuthError ( {
824824 ...AuthClientErrorCode . INTERNAL_ERROR ,
825825 message : 'INTERNAL ASSERT FAILED: Unable to create new user' ,
826- httpResponse : response ,
826+ httpResponse : toHttpResponse ( response ) ,
827827 } ) ;
828828 }
829829 } ) ;
@@ -856,7 +856,7 @@ const FIREBASE_AUTH_GET_OOB_CODE = new ApiSettings('/accounts:sendOobCode', 'POS
856856 throw new FirebaseAuthError ( {
857857 ...AuthClientErrorCode . INTERNAL_ERROR ,
858858 message : 'INTERNAL ASSERT FAILED: Unable to create the email action link' ,
859- httpResponse : response ,
859+ httpResponse : toHttpResponse ( response ) ,
860860 } ) ;
861861 }
862862 } ) ;
@@ -875,7 +875,7 @@ const GET_OAUTH_IDP_CONFIG = new ApiSettings('/oauthIdpConfigs/{providerId}', 'G
875875 throw new FirebaseAuthError ( {
876876 ...AuthClientErrorCode . INTERNAL_ERROR ,
877877 message : 'INTERNAL ASSERT FAILED: Unable to get OIDC configuration' ,
878- httpResponse : response ,
878+ httpResponse : toHttpResponse ( response ) ,
879879 } ) ;
880880 }
881881 } ) ;
@@ -901,7 +901,7 @@ const CREATE_OAUTH_IDP_CONFIG = new ApiSettings('/oauthIdpConfigs?oauthIdpConfig
901901 throw new FirebaseAuthError ( {
902902 ...AuthClientErrorCode . INTERNAL_ERROR ,
903903 message : 'INTERNAL ASSERT FAILED: Unable to create new OIDC configuration' ,
904- httpResponse : response ,
904+ httpResponse : toHttpResponse ( response ) ,
905905 } ) ;
906906 }
907907 } ) ;
@@ -920,7 +920,7 @@ const UPDATE_OAUTH_IDP_CONFIG = new ApiSettings('/oauthIdpConfigs/{providerId}?u
920920 throw new FirebaseAuthError ( {
921921 ...AuthClientErrorCode . INTERNAL_ERROR ,
922922 message : 'INTERNAL ASSERT FAILED: Unable to update OIDC configuration' ,
923- httpResponse : response ,
923+ httpResponse : toHttpResponse ( response ) ,
924924 } ) ;
925925 }
926926 } ) ;
@@ -964,7 +964,7 @@ const GET_INBOUND_SAML_CONFIG = new ApiSettings('/inboundSamlConfigs/{providerId
964964 throw new FirebaseAuthError ( {
965965 ...AuthClientErrorCode . INTERNAL_ERROR ,
966966 message : 'INTERNAL ASSERT FAILED: Unable to get SAML configuration' ,
967- httpResponse : response ,
967+ httpResponse : toHttpResponse ( response ) ,
968968 } ) ;
969969 }
970970 } ) ;
@@ -990,7 +990,7 @@ const CREATE_INBOUND_SAML_CONFIG = new ApiSettings('/inboundSamlConfigs?inboundS
990990 throw new FirebaseAuthError ( {
991991 ...AuthClientErrorCode . INTERNAL_ERROR ,
992992 message : 'INTERNAL ASSERT FAILED: Unable to create new SAML configuration' ,
993- httpResponse : response ,
993+ httpResponse : toHttpResponse ( response ) ,
994994 } ) ;
995995 }
996996 } ) ;
@@ -1009,7 +1009,7 @@ const UPDATE_INBOUND_SAML_CONFIG = new ApiSettings('/inboundSamlConfigs/{provide
10091009 throw new FirebaseAuthError ( {
10101010 ...AuthClientErrorCode . INTERNAL_ERROR ,
10111011 message : 'INTERNAL ASSERT FAILED: Unable to update SAML configuration' ,
1012- httpResponse : response ,
1012+ httpResponse : toHttpResponse ( response ) ,
10131013 } ) ;
10141014 }
10151015 } ) ;
@@ -1977,7 +1977,7 @@ export abstract class AbstractAuthRequestHandler {
19771977 ...AuthClientErrorCode . INTERNAL_ERROR ,
19781978 message : 'An internal error occurred while attempting to extract the errorcode from the error.' ,
19791979 cause : err ,
1980- httpResponse : err . response ,
1980+ httpResponse : toHttpResponse ( err . response ) ,
19811981 } ) ;
19821982 }
19831983 throw FirebaseAuthError . fromServerError ( errorCode , /* message */ undefined , err ) ;
@@ -2026,7 +2026,7 @@ const GET_PROJECT_CONFIG = new ApiSettings('/config', 'GET')
20262026 throw new FirebaseAuthError ( {
20272027 ...AuthClientErrorCode . INTERNAL_ERROR ,
20282028 message : 'INTERNAL ASSERT FAILED: Unable to get project config' ,
2029- httpResponse : response ,
2029+ httpResponse : toHttpResponse ( response ) ,
20302030 } ) ;
20312031 }
20322032 } ) ;
@@ -2040,7 +2040,7 @@ const UPDATE_PROJECT_CONFIG = new ApiSettings('/config?updateMask={updateMask}',
20402040 throw new FirebaseAuthError ( {
20412041 ...AuthClientErrorCode . INTERNAL_ERROR ,
20422042 message : 'INTERNAL ASSERT FAILED: Unable to update project config' ,
2043- httpResponse : response ,
2043+ httpResponse : toHttpResponse ( response ) ,
20442044 } ) ;
20452045 }
20462046 } ) ;
@@ -2055,7 +2055,7 @@ const GET_TENANT = new ApiSettings('/tenants/{tenantId}', 'GET')
20552055 throw new FirebaseAuthError ( {
20562056 ...AuthClientErrorCode . INTERNAL_ERROR ,
20572057 message : 'INTERNAL ASSERT FAILED: Unable to get tenant' ,
2058- httpResponse : response ,
2058+ httpResponse : toHttpResponse ( response ) ,
20592059 } ) ;
20602060 }
20612061 } ) ;
@@ -2074,7 +2074,7 @@ const UPDATE_TENANT = new ApiSettings('/tenants/{tenantId}?updateMask={updateMas
20742074 throw new FirebaseAuthError ( {
20752075 ...AuthClientErrorCode . INTERNAL_ERROR ,
20762076 message : 'INTERNAL ASSERT FAILED: Unable to update tenant' ,
2077- httpResponse : response ,
2077+ httpResponse : toHttpResponse ( response ) ,
20782078 } ) ;
20792079 }
20802080 } ) ;
@@ -2111,7 +2111,7 @@ const CREATE_TENANT = new ApiSettings('/tenants', 'POST')
21112111 throw new FirebaseAuthError ( {
21122112 ...AuthClientErrorCode . INTERNAL_ERROR ,
21132113 message : 'INTERNAL ASSERT FAILED: Unable to create tenant' ,
2114- httpResponse : response ,
2114+ httpResponse : toHttpResponse ( response ) ,
21152115 } ) ;
21162116 }
21172117 } ) ;
0 commit comments