[ 
https://issues.apache.org/jira/browse/SOLR-10956?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16064144#comment-16064144
 ] 

Jason Gerlowski commented on SOLR-10956:
----------------------------------------

Based on some quick digging, it looks like SolrClient's make use of the 
following exceptions:
- {{RemoteSolrException}} - used when a HTTP request was successfully sent to 
Solr, but the response from Solr indicated an error.  Contains HTTP status 
code.  Lumping in some {{RemoteExecutionException}} uses here, as that 
exception is a descendant of this one.
- {{SolrServerException}} - used on connection/timeout/parsing or other errors 
related to communicating with Solr.  In almost all cases, a successful HTTP 
request was _not_ made, or the response could not be parsed.

> Document SolrClient use of RemoteSolrException
> ----------------------------------------------
>
>                 Key: SOLR-10956
>                 URL: https://issues.apache.org/jira/browse/SOLR-10956
>             Project: Solr
>          Issue Type: Bug
>      Security Level: Public(Default Security Level. Issues are Public) 
>          Components: SolrJ
>    Affects Versions: master (7.0)
>            Reporter: Jason Gerlowski
>            Priority: Minor
>
> Currently, {{SolrClient}}s Javadocs specify that it throws IOException, and 
> SolrServerException.  However, these aren't the only exceptions that can 
> trickle out of these classes.
> {{RemoteSolrException}} for example, is often thrown by {{HttpSolrClient}} on 
> various error cases:
> {code}
> [~/c/lucene-solr] $ grep -rI "throw new RemoteSolrException" . | grep 
> SolrClient.java
> ./solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrClient.java:  
>           throw new RemoteSolrException(baseUrl, httpStatus, "non ok status: 
> " + httpStatus
> ./solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrClient.java:  
>           throw new RemoteSolrException(baseUrl, httpStatus, "Could not parse 
> response with encoding " + encoding, e);
> ./solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrClient.java:  
>         throw new RemoteSolrException(baseUrl, httpStatus, msg, null);
> ./solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrClient.java:  
>       throw new RemoteSolrException(baseUrl, httpStatus, e.getMessage(), e);
> {code}
> (LBHttpSolrClient, and CloudSolrClient also see these exception, since they 
> wrap HttpSolrClient internally)
> We should either restrict the exceptions we throw in our clients, or better 
> document the full range of possible exceptions/error-cases so that users can 
> better handle things themselves.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to