lucy-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Karman <pe...@peknet.com>
Subject Re: [lucy-dev] Error reporting in allot_params
Date Sat, 08 Jan 2011 11:29:32 GMT
Marvin Humphrey wrote on 1/6/11 9:31 PM:

> If we change allot_params() to return false and store an exception object in
> Err_error on failure, then the calling code can RETHROW the exception...
> 
>         bool_t args_ok = XSBind_allot_params( &(ST(0)), 1, 
>             items, "Lucy::Search::IndexSearcher::new_PARAMS", 
>             &index_sv, "index", 5,
>             NULL);
>         if (!args_ok) {
>             RETHROW(INCREF(Err_get_error()));
>         }   
> 
> ... so that we see its location in the stack trace instead.
> 
>     Invalid parameter: 'bogus'
>         cfish_XSBind_allot_params at xs/XSBind.c line 408
>         XS_Lucy_Search_IndexSearcher_new at lib/Lucy.xs line 1647
>         at foo.t line 5
> 
> "XS_Lucy_Search_IndexSearcher_new" isn't quite as good as
> "Lucy::Search::IndexSearcher::new", but it's better than nothing.
> 

+1


-- 
Peter Karman  .  http://peknet.com/  .  peter@peknet.com

Mime
View raw message