from function
Converts a dynamic
to a GoogleGenerativeAIException.
Will populate default messages as expected, and propagate the provided cause
through the
resulting exception.
Implementation
GoogleGenerativeAIException from(dynamic cause) {
if (cause is GoogleGenerativeAIException) {
return cause;
} else if ( cause is SerializationException) {
return SerializationException(
"Something went wrong while trying to deserialize a response from the server.",
cause,
);
} else {
return UnknownException("Something unexpected happened.", cause);
}
}