Skip to content

Commit fe2ebb0

Browse files
fix(olostep): preserve plain-text error bodies and strengthen malformed JSON test
- Include json.raw fallback in makeRequest error extraction so non-JSON error responses from the API are surfaced rather than falling back to the generic HTTP status message - Strengthen malformed-JSON test to assert res.success is true (not just res.data.operation) so regressions in the graceful fallback path are caught
1 parent 8f41cc7 commit fe2ebb0

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

packages/bubble-core/src/bubbles/service-bubble/olostep.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,8 +415,9 @@ describe('OlostepBubble', () => {
415415

416416
const res = await bubble.action();
417417

418-
// Implementation gracefully handles malformed JSON by returning raw text
418+
// Graceful fallback: parses raw text, returns success with raw content
419419
expect(res.data.operation).toBe('scrape');
420+
expect(res.success).toBe(true);
420421
});
421422

422423
it('should handle missing credentials gracefully', async () => {

packages/bubble-core/src/bubbles/service-bubble/olostep.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,9 @@ export class OlostepBubble extends ServiceBubble<OlostepParams, OlostepResult> {
566566
const errorMessage =
567567
typeof json?.error === 'string'
568568
? json.error
569-
: json?.error?.message || json?.message;
569+
: json?.error?.message ||
570+
json?.message ||
571+
(typeof json?.raw === 'string' ? json.raw : undefined);
570572
throw new Error(errorMessage || `HTTP ${response.status}`);
571573
}
572574

0 commit comments

Comments
 (0)