File tree Expand file tree Collapse file tree 2 files changed +13
-6
lines changed Expand file tree Collapse file tree 2 files changed +13
-6
lines changed Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " react-native-update" ,
3
- "version" : " 10.30.0 " ,
3
+ "version" : " 10.30.1 " ,
4
4
"description" : " react-native hot update" ,
5
5
"main" : " src/index" ,
6
6
"scripts" : {
Original file line number Diff line number Diff line change @@ -109,9 +109,16 @@ export const enhancedFetch = async (
109
109
url : string ,
110
110
params : Parameters < typeof fetch > [ 1 ] ,
111
111
) => {
112
- return fetch ( url , params ) . catch ( e => {
113
- log ( 'fetch error' , url , e ) ;
114
- log ( 'trying fallback to http' ) ;
115
- return fetch ( url . replace ( 'https' , 'http' ) , params ) ;
116
- } ) ;
112
+ return fetch ( url , params )
113
+ . then ( r => {
114
+ if ( r . ok ) {
115
+ return r ;
116
+ }
117
+ throw new Error ( `${ r . status } ${ r . statusText } ` ) ;
118
+ } )
119
+ . catch ( e => {
120
+ log ( 'fetch error' , url , e ) ;
121
+ log ( 'trying fallback to http' ) ;
122
+ return fetch ( url . replace ( 'https' , 'http' ) , params ) ;
123
+ } ) ;
117
124
} ;
You can’t perform that action at this time.
0 commit comments