Skip to content

Commit

Permalink
fix(prompts): handle non-json gateway errors (#503)
Browse files Browse the repository at this point in the history
  • Loading branch information
hassiebp authored Feb 3, 2025
1 parent 42ffca6 commit 3a88df8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions langfuse-core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -586,12 +586,12 @@ abstract class LangfuseCoreStateless {
}
);

const data = await res.json();

if (res.status >= 500) {
throw new LangfuseFetchHttpError(res, JSON.stringify(data));
throw new LangfuseFetchHttpError(res, await res.text());
}

const data = await res.json();

return { fetchResult: res.status === 200 ? "success" : "failure", data };
},
retryOptions,
Expand Down

0 comments on commit 3a88df8

Please sign in to comment.