Skip to content

Commit

Permalink
remove unnecessary handle error
Browse files Browse the repository at this point in the history
  • Loading branch information
vsseixaso committed Jun 4, 2024
1 parent aa17d3a commit 4040f78
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/HttpClient/middlewares/cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -224,19 +224,16 @@ export const cacheMiddleware = ({ type, storage, asyncSet }: CacheOptions) => {

const cacheWriteSpan = createCacheSpan(cacheType, 'write', tracer, span)
try {
const storageSet = async () =>
await storage.set(setKey, {
const storageSet = () =>
storage.set(setKey, {
etag,
expiration,
response: {data: cacheableData, headers, status},
responseEncoding,
responseType,
})
if (asyncSet) {
storageSet().catch(error => {
ErrorReport.create({ originalError: error }).injectOnSpan(cacheWriteSpan)
logger?.warn({ message: 'Error writing to the HttpClient cache asynchronously', error })
})
storageSet()
} else {
await storageSet()
span?.log({
Expand Down

0 comments on commit 4040f78

Please sign in to comment.