MCPcopy Index your code
hub / github.com/CodebuffAI/codebuff / parseFireworksErrorFromText

Function parseFireworksErrorFromText

web/src/llm-api/fireworks.ts:779–812  ·  view source on GitHub ↗
(
  statusCode: number,
  statusText: string,
  errorText: string,
)

Source from the content-addressed store, hash-verified

777}
778
779function parseFireworksErrorFromText(
780 statusCode: number,
781 statusText: string,
782 errorText: string,
783): FireworksError {
784 let errorBody: FireworksError['errorBody']
785 try {
786 const parsed = JSON.parse(errorText)
787 if (parsed?.error?.message) {
788 errorBody = {
789 error: {
790 message: parsed.error.message,
791 code: parsed.error.code ?? null,
792 type: parsed.error.type ?? null,
793 },
794 }
795 } else {
796 errorBody = {
797 error: {
798 message: errorText || statusText,
799 code: statusCode,
800 },
801 }
802 }
803 } catch {
804 errorBody = {
805 error: {
806 message: errorText || statusText,
807 code: statusCode,
808 },
809 }
810 }
811 return new FireworksError(statusCode, statusText, errorBody)
812}
813
814async function parseFireworksError(
815 response: Response,

Callers 1

parseFireworksErrorFunction · 0.85

Calls 1

parseMethod · 0.80

Tested by

no test coverage detected