File tree Expand file tree Collapse file tree 1 file changed +15
-13
lines changed Expand file tree Collapse file tree 1 file changed +15
-13
lines changed Original file line number Diff line number Diff line change @@ -252,19 +252,20 @@ export function sendRequest(queryObject, options) {
252252 }
253253 }
254254
255- let getCacheCallback = function ( ) {
255+ let getCacheCallback = function ( resolve , reject ) {
256256 return function ( err , entries ) {
257- return new Promise ( function ( resolve , reject ) {
258- try {
259- if ( err ) reject ( err ) ;
260- if ( ! tojson ) entries = resultWrapper ( entries ) ;
261- resolve ( spreadResult ( entries ) ) ;
262- } catch ( e ) {
263- reject ( e )
257+ try {
258+ if ( err ) {
259+ return reject ( err ) ; // Propagate the error to the parent promise
264260 }
265- } ) ;
266- }
267- }
261+ if ( ! tojson ) entries = resultWrapper ( entries ) ;
262+ resolve ( spreadResult ( entries ) ) ; // Propagate the result to the parent promise
263+ } catch ( e ) {
264+ reject ( e ) ; // Handle any synchronous errors
265+ }
266+ } ;
267+ } ;
268+
268269
269270 let callback = function ( continueFlag , resolve , reject ) {
270271 if ( continueFlag ) {
@@ -339,11 +340,12 @@ export function sendRequest(queryObject, options) {
339340 } . bind ( self ) )
340341 . catch ( function ( error ) {
341342 if ( cachePolicy === 2 && self . provider !== null ) {
342- self . provider . get ( hashQuery , getCacheCallback ( ) ) ;
343+ self . provider . get ( hashQuery , getCacheCallback ( resolve , reject ) ) ;
343344 } else {
344- return reject ( error ) ;
345+ reject ( error ) ;
345346 }
346347 } ) ;
348+
347349 }
348350 }
349351 switch ( cachePolicy ) {
You can’t perform that action at this time.
0 commit comments