[
https://issues.apache.org/jira/browse/SOLR-183?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12478980
]
J.J. Larrea commented on SOLR-183:
----------------------------------
By the way, I think your logic to catch type conversion errors and return 400
with a specific error rather than let the request dispatcher return a generic
500, is very useful, but should be implemented directly in SolrParams and then
get inherited by RequiredSolrParams, ServletSolrParams, etc.
The concern of "supplied or not" is different from the concern of "well-formed
or not", and params.getInt( param-returning-"notint" ) is an error, and should
ALWAYS return a specific and informative exception (code and message) as you
have done, regardless of the underlying SolrParams implementation. Ditto for
params.getInt( param-returning-"notint", 999 ).
> add getRequiredParameter() to SolrParams
> ----------------------------------------
>
> Key: SOLR-183
> URL: https://issues.apache.org/jira/browse/SOLR-183
> Project: Solr
> Issue Type: Wish
> Reporter: Ryan McKinley
> Priority: Trivial
> Attachments: RequiredSolrParams.java, SOLR-183-required-param.patch,
> SOLR-183-required-param.patch
>
>
> I find myself including this with every patch, so i'll just separate it out.
> This simply adds a utilty function to SolrParams that throws a 400 if the
> parameter is missing:
> /** returns the value of the param, or throws a 400 exception if missing */
> public String getRequiredParameter(String param) throws SolrException {
> String val = get(param);
> if( val == null ) {
> throw new SolrException( 400, "Missing parameter: "+param );
> }
> return val;
> }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.