File tree Expand file tree Collapse file tree 2 files changed +6
-13
lines changed
packages/firestore/src/platform Expand file tree Collapse file tree 2 files changed +6
-13
lines changed Original file line number Diff line number Diff line change @@ -97,11 +97,11 @@ export class WebChannelConnection extends RestConnection {
97
97
xhr . getResponseText ( )
98
98
) ;
99
99
if ( status > 0 ) {
100
- let response = xhr . getResponseJson ( ) as WebChannelError ;
100
+ let response = xhr . getResponseJson ( ) ;
101
101
if ( Array . isArray ( response ) ) {
102
102
response = response [ 0 ] ;
103
103
}
104
- const responseError = response ?. error ;
104
+ const responseError = ( response as WebChannelError ) ?. error ;
105
105
if (
106
106
! ! responseError &&
107
107
! ! responseError . status &&
Original file line number Diff line number Diff line change @@ -69,18 +69,11 @@ export class FetchConnection extends RestConnection {
69
69
}
70
70
71
71
if ( ! response . ok ) {
72
- let errorResponse ;
73
- try {
74
- [ errorResponse ] = ( await response . json ( ) ) as [
75
- {
76
- error ?: { message ?: string } ;
77
- }
78
- ] ;
79
- } catch ( _ignored ) { }
80
- let errorMessage ;
81
- if ( errorResponse ) {
82
- errorMessage = errorResponse . error ?. message ;
72
+ let errorResponse = await response . json ( ) ;
73
+ if ( Array . isArray ( errorResponse ) ) {
74
+ errorResponse = errorResponse [ 0 ] ;
83
75
}
76
+ const errorMessage = errorResponse ?. error ?. message ;
84
77
throw new FirestoreError (
85
78
mapCodeFromHttpStatus ( response . status ) ,
86
79
`Request failed with error: ${ errorMessage ?? response . statusText } `
You can’t perform that action at this time.
0 commit comments