Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,9 @@ private suspend fun validateResponse(response: HttpResponse) {
throw PromptBlockedException(message)
}
if (message.contains("genai config not found")) {
throw APINotConfiguredException()
throw APINotConfiguredException(
"The Gemini Developer API is not enabled, to enable and configure, see https://firebase.google.com/docs/ai-logic/faq-and-troubleshooting?api=dev#error-genai-config-not-found"
)
}
getServiceDisabledErrorDetailsOrNull(error)?.let {
val errorMessage =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,14 @@ internal class UnsupportedUserLocationException(cause: Throwable? = null) :
FirebaseCommonAIException("User location is not supported for the API use.", cause)

/**
* The user's project does not have the Gemini Developer API enabled in the Firebase Console.
* The user's project has not been configured and enabled for the selected API.
*
* See the Firebase documentation for the
* For the Gemini Developer API, see
* [steps](https://firebase.google.com/docs/ai-logic/faq-and-troubleshooting?api=dev#error-genai-config-not-found)
* to enable the Gemini Developer API.
* .
*/
internal class APINotConfiguredException(cause: Throwable? = null) :
FirebaseCommonAIException("Gemini Developer API not enabled in Firebase console.", cause)
internal class APINotConfiguredException(message: String, cause: Throwable? = null) :
FirebaseCommonAIException(message, cause)

/**
* Some form of state occurred that shouldn't have.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ internal constructor(message: String, cause: Throwable? = null) : RuntimeExcepti
is com.google.firebase.ai.common.QuotaExceededException ->
QuotaExceededException(cause.message ?: "", cause.cause)
is com.google.firebase.ai.common.APINotConfiguredException ->
APINotConfiguredException(cause.cause)
APINotConfiguredException(cause.message ?: "", cause.cause)
else -> UnknownException(cause.message ?: "", cause)
}
is TimeoutCancellationException ->
Expand Down Expand Up @@ -152,14 +152,15 @@ public class UnsupportedUserLocationException internal constructor(cause: Throwa
FirebaseAIException("User location is not supported for the API use.", cause)

/**
* The user's project does not have the Gemini Developer API enabled in the Firebase Console.
* The user's project has not been configured and enabled for the selected API.
*
* See the Firebase documentation for the
* For the Gemini Developer API, see
* [steps](https://firebase.google.com/docs/ai-logic/faq-and-troubleshooting?api=dev#error-genai-config-not-found)
* to enable the Gemini Developer API.
* .
*/
public class APINotConfiguredException internal constructor(cause: Throwable? = null) :
FirebaseAIException("Gemini Developer API not enabled in Firebase console.", cause)
public class APINotConfiguredException
internal constructor(message: String, cause: Throwable? = null) :
FirebaseAIException(message, cause)

/**
* Some form of state occurred that shouldn't have.
Expand Down
Loading