File tree 2 files changed +21
-24
lines changed
packages/browser/src/transports
2 files changed +21
-24
lines changed Original file line number Diff line number Diff line change 2
2
3
3
## Unreleased
4
4
5
- - Coming soon...
5
+ - [ browser ] ref: Fix regression with bundle size
6
6
7
7
## 5.9.0
8
8
Original file line number Diff line number Diff line change @@ -33,29 +33,26 @@ export class FetchTransport extends BaseTransport {
33
33
} ;
34
34
35
35
return this . _buffer . add (
36
- new SyncPromise < Response > ( async ( resolve , reject ) => {
37
- let response ;
38
- try {
39
- response = await global . fetch ( this . url , defaultOptions ) ;
40
- } catch ( err ) {
41
- reject ( err ) ;
42
- return ;
43
- }
44
-
45
- const status = Status . fromHttpCode ( response . status ) ;
46
-
47
- if ( status === Status . Success ) {
48
- resolve ( { status } ) ;
49
- return ;
50
- }
51
-
52
- if ( status === Status . RateLimit ) {
53
- const now = Date . now ( ) ;
54
- this . _disabledUntil = new Date ( now + parseRetryAfterHeader ( now , response . headers . get ( 'Retry-After' ) ) ) ;
55
- logger . warn ( `Too many requests, backing off till: ${ this . _disabledUntil } ` ) ;
56
- }
57
-
58
- reject ( response ) ;
36
+ new SyncPromise < Response > ( ( resolve , reject ) => {
37
+ global
38
+ . fetch ( this . url , defaultOptions )
39
+ . then ( response => {
40
+ const status = Status . fromHttpCode ( response . status ) ;
41
+
42
+ if ( status === Status . Success ) {
43
+ resolve ( { status } ) ;
44
+ return ;
45
+ }
46
+
47
+ if ( status === Status . RateLimit ) {
48
+ const now = Date . now ( ) ;
49
+ this . _disabledUntil = new Date ( now + parseRetryAfterHeader ( now , response . headers . get ( 'Retry-After' ) ) ) ;
50
+ logger . warn ( `Too many requests, backing off till: ${ this . _disabledUntil } ` ) ;
51
+ }
52
+
53
+ reject ( response ) ;
54
+ } )
55
+ . catch ( reject ) ;
59
56
} ) ,
60
57
) ;
61
58
}
You can’t perform that action at this time.
0 commit comments