(target, thisArg, args)
| 147 | ): (...args: unknown[]) => unknown { |
| 148 | return new Proxy(original, { |
| 149 | async apply(target, thisArg, args) { |
| 150 | const options = createSpanStartOptions(methodName, driver, mountBase, args); |
| 151 | |
| 152 | debug.log(`[storage] Running method: "${methodName}" on driver: "${driver.name ?? 'unknown'}"`); |
| 153 | |
| 154 | return startSpan(options, async span => { |
| 155 | try { |
| 156 | const result = await target.apply(thisArg, args); |
| 157 | span.setStatus({ code: SPAN_STATUS_OK }); |
| 158 | |
| 159 | if (CACHE_HIT_METHODS.has(methodName)) { |
| 160 | span.setAttribute(SEMANTIC_ATTRIBUTE_CACHE_HIT, isCacheHit(args[0], result)); |
| 161 | } |
| 162 | |
| 163 | return result; |
| 164 | } catch (error) { |
| 165 | span.setStatus({ code: SPAN_STATUS_ERROR, message: 'internal_error' }); |
| 166 | captureException(error, { |
| 167 | mechanism: { |
| 168 | handled: false, |
| 169 | type: options.attributes?.[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN], |
| 170 | }, |
| 171 | }); |
| 172 | |
| 173 | // Re-throw the error to be handled by the caller |
| 174 | throw error; |
| 175 | } finally { |
| 176 | await flushIfServerless(); |
| 177 | } |
| 178 | }); |
| 179 | }, |
| 180 | }); |
| 181 | } |
| 182 |
nothing calls this directly
no test coverage detected