File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
plugins/modules-config/validations/socai/providers Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -45,13 +45,21 @@ func (p *GeminiProvider) testConnection() error {
4545 case http .StatusOK :
4646 return nil
4747 case http .StatusBadRequest :
48- return fmt .Errorf ("Invalid Gemini API Key. Please verify your x-api-key is correct." )
48+ if strings .HasPrefix (err .Error (),"API key not valid." ){
49+ return fmt .Errorf ("Invalid Gemini API Key. Please verify your x-api-key is correct." )
50+ }else {
51+ return nil
52+ }
4953 case http .StatusUnauthorized :
5054 return fmt .Errorf ("Invalid Google Gemini API Key. Please verify your API Key is correct." )
5155 case http .StatusForbidden :
5256 return fmt .Errorf ("Google Gemini API Key does not have the required permissions (HTTP 403)." )
5357 case http .StatusNotFound , http .StatusMethodNotAllowed :
54- return fmt .Errorf ("Google Gemini API endpoint not found (HTTP 404). Please verify the API URL is correct." )
58+ if strings .HasSuffix (err .Error (),"available models and their supported methods." ){
59+ return fmt .Errorf ("Invalid Gemini model %s." ,p .Model )
60+ }else {
61+ return nil
62+ }
5563 case http .StatusTooManyRequests :
5664 return fmt .Errorf ("Google Gemini API rate limit exceeded (HTTP 429). Your API Key may have exceeded its quota." )
5765 default :
You can’t perform that action at this time.
0 commit comments