(target, thisArg, argumentsList)
| 239 | function instrumentAuthOperation(operation: AuthOperationFn, isAdmin = false): AuthOperationFn { |
| 240 | return new Proxy(operation, { |
| 241 | apply(target, thisArg, argumentsList) { |
| 242 | return startSpan( |
| 243 | { |
| 244 | name: `auth ${isAdmin ? '(admin) ' : ''}${operation.name}`, |
| 245 | attributes: { |
| 246 | [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.db.supabase', |
| 247 | [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'db', |
| 248 | 'db.system': 'postgresql', |
| 249 | 'db.operation': `auth.${isAdmin ? 'admin.' : ''}${operation.name}`, |
| 250 | }, |
| 251 | }, |
| 252 | span => { |
| 253 | return Reflect.apply(target, thisArg, argumentsList) |
| 254 | .then((res: unknown) => { |
| 255 | if (res && typeof res === 'object' && 'error' in res && res.error) { |
| 256 | span.setStatus({ code: SPAN_STATUS_ERROR }); |
| 257 | |
| 258 | captureException(res.error, { |
| 259 | mechanism: { |
| 260 | handled: false, |
| 261 | type: 'auto.db.supabase.auth', |
| 262 | }, |
| 263 | }); |
| 264 | } else { |
| 265 | span.setStatus({ code: SPAN_STATUS_OK }); |
| 266 | } |
| 267 | |
| 268 | span.end(); |
| 269 | return res; |
| 270 | }) |
| 271 | .catch((err: unknown) => { |
| 272 | span.setStatus({ code: SPAN_STATUS_ERROR }); |
| 273 | span.end(); |
| 274 | |
| 275 | captureException(err, { |
| 276 | mechanism: { |
| 277 | handled: false, |
| 278 | type: 'auto.db.supabase.auth', |
| 279 | }, |
| 280 | }); |
| 281 | |
| 282 | throw err; |
| 283 | }) |
| 284 | .then(...argumentsList); |
| 285 | }, |
| 286 | ); |
| 287 | }, |
| 288 | }); |
| 289 | } |
| 290 |
nothing calls this directly
no test coverage detected