fix(httpapi): expose v2 catalog errors (#28498)

This commit is contained in:
Shoubhit Dash
2026-05-21 00:53:35 +05:30
committed by GitHub
parent 7690481fc1
commit 4308dd75fb
8 changed files with 82 additions and 14 deletions

View File

@@ -98,12 +98,14 @@ function assistant(id: string) {
} satisfies SdkEvent
}
function feed<T>() {
const StreamClosed = undefined as never
function feed<T, R = never>(returnValue: R = StreamClosed) {
const list: T[] = []
let done = false
let wake: (() => void) | undefined
const wrapped = (async function* () {
const wrapped = (async function* (): AsyncGenerator<T, R, unknown> {
while (!done || list.length > 0) {
if (list.length === 0) {
await new Promise<void>((resolve) => {
@@ -119,6 +121,7 @@ function feed<T>() {
yield next
}
return returnValue as R
})()
return {
@@ -166,10 +169,11 @@ function globalSse(stream: GlobalEventStream) {
}
function wrapGlobalStream(stream: EventStream): GlobalEventStream {
return (async function* () {
return (async function* (): GlobalEventStream {
for await (const event of stream) {
yield globalEvent(event)
}
return StreamClosed
})()
}