Defensively handle text() failure in flush warnings

Co-Authored-By: Konstantin Wohlwend <n2d4xc@gmail.com>
This commit is contained in:
Devin AI 2026-05-27 21:35:44 +00:00
parent 8706f61350
commit ee3e822b17
2 changed files with 4 additions and 2 deletions

View File

@ -290,7 +290,8 @@ export class EventTracker {
}
if (!res.data.ok) {
captureWarning("EventTracker.flush()", new Error(`EventTracker flush failed: ${res.data.status} ${await res.data.text()}`));
const body = await res.data.text().catch(() => "<unable to read response body>");
captureWarning("EventTracker.flush()", new Error(`EventTracker flush failed: ${res.data.status} ${body}`));
}
}

View File

@ -261,7 +261,8 @@ export class SessionRecorder {
}
if (!res.data.ok) {
captureWarning("SessionRecorder.flush()", new Error(`SessionRecorder flush failed: ${res.data.status} ${await res.data.text()}`));
const body = await res.data.text().catch(() => "<unable to read response body>");
captureWarning("SessionRecorder.flush()", new Error(`SessionRecorder flush failed: ${res.data.status} ${body}`));
}
} finally {
this._flushInProgress = false;