| 78912 | } catch (e3) { |
| 78913 | handleResponseError(e3, url2); |
| 78914 | } |
| 78915 | if (!response.ok) { |
| 78916 | await handleResponseNotOk(response, url2); |
| 78917 | } |
| 78918 | return response; |
| 78919 | } |
| 78920 | function handleResponseError(e3, url2) { |
| 78921 | let err = e3; |
| 78922 | if (err.name === "AbortError") { |
| 78923 | err = new GoogleGenerativeAIAbortError(`Request aborted when fetching ${url2.toString()}: ${e3.message}`); |
| 78924 | err.stack = e3.stack; |
| 78925 | } else if (!(e3 instanceof GoogleGenerativeAIFetchError || e3 instanceof GoogleGenerativeAIRequestInputError)) { |
| 78926 | err = new GoogleGenerativeAIError(`Error fetching from ${url2.toString()}: ${e3.message}`); |
| 78927 | err.stack = e3.stack; |