File tree Expand file tree Collapse file tree 2 files changed +13
-0
lines changed
firebase-ai/src/main/kotlin/com/google/firebase/ai/common Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -334,6 +334,9 @@ private suspend fun validateResponse(response: HttpResponse) {
334334 if (message.contains(" The prompt could not be submitted" )) {
335335 throw PromptBlockedException (message)
336336 }
337+ if (message.contains(" genai config not found" )) {
338+ throw NotConfiguredException (message)
339+ }
337340 getServiceDisabledErrorDetailsOrNull(error)?.let {
338341 val errorMessage =
339342 if (it.metadata?.get(" service" ) == " firebasevertexai.googleapis.com" ) {
Original file line number Diff line number Diff line change @@ -89,6 +89,16 @@ internal constructor(
8989internal class UnsupportedUserLocationException (cause : Throwable ? = null ) :
9090 FirebaseCommonAIException (" User location is not supported for the API use." , cause)
9191
92+ /* *
93+ * The user's project does not have the Gemini Developer API enabled in the Firebase Console.
94+ *
95+ * See the Firebase documentation for the
96+ * [steps](https://firebase.google.com/docs/ai-logic/faq-and-troubleshooting?api=dev#error-genai-config-not-found)
97+ * to enable the Gemini Developer API.
98+ */
99+ internal class NotConfiguredException (cause : Throwable ? = null ) :
100+ FirebaseCommonAIException (" Gemini Developer API not enabled in Firebase console." , cause)
101+
92102/* *
93103 * Some form of state occurred that shouldn't have.
94104 *
You can’t perform that action at this time.
0 commit comments