Commit 8ef1d20
committed
fix(core): Use startInactiveSpan to preserve OpenAI APIPromise
- Use startInactiveSpan instead of startSpan/startSpanManual because they internally use handleCallbackErrors which calls .then() on Promises, creating a new instance and losing APIPromise methods
- Add try-catch for synchronous exceptions
- Use .finally() to ensure span always ends even if attribute processing throws
- Add tests for error handling (sync throw + async reject)
- Update tests to match real OpenAI SDK behavior1 parent 2aaa332 commit 8ef1d20
1 file changed
+31
-19
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
231 | 231 | | |
232 | 232 | | |
233 | 233 | | |
234 | | - | |
235 | | - | |
236 | | - | |
237 | | - | |
238 | | - | |
239 | | - | |
240 | | - | |
241 | | - | |
242 | | - | |
243 | | - | |
244 | | - | |
245 | | - | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
246 | 252 | | |
247 | | - | |
248 | | - | |
249 | | - | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
250 | 258 | | |
251 | | - | |
252 | | - | |
| 259 | + | |
253 | 260 | | |
254 | 261 | | |
255 | | - | |
256 | | - | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
257 | 269 | | |
258 | 270 | | |
259 | 271 | | |
| |||
0 commit comments