Updated to error handling and testsuite changes in Pigeonhole.
authorStephan Bosch <stephan@rename-it.nl>
Sat Sep 04 14:56:46 2010 +0200 (2010-09-04)
changeset 29fa9355a369ff
parent 28 c24428a2252c
child 30 942eca9e7497
Updated to error handling and testsuite changes in Pigeonhole.
src/ext-extdata-common.c
tests/extdata-namespace.svtest
tests/extdata-test.svtest
     1.1 --- a/src/ext-extdata-common.c	Tue Aug 17 18:40:31 2010 +0200
     1.2 +++ b/src/ext-extdata-common.c	Sat Sep 04 14:56:46 2010 +0200
     1.3 @@ -31,7 +31,8 @@
     1.4  
     1.5  	dict_uri = sieve_setting_get(ext->svinst, "sieve_extdata_dict_uri");
     1.6  	if ( dict_uri == NULL ) {
     1.7 -		sieve_sys_warning("extdata: no dict uri specified, extension is unconfigured "
     1.8 +		sieve_sys_warning(ext->svinst, 
     1.9 +			"extdata: no dict uri specified, extension is unconfigured "
    1.10  			"(sieve_extdata_dict_uri is not set).");
    1.11  	}
    1.12  
    1.13 @@ -90,7 +91,7 @@
    1.14  		(struct ext_extdata_interpreter_context *)
    1.15  		sieve_interpreter_extension_get_context(renv->interp, ext);
    1.16  	const struct sieve_script_env *senv = renv->scriptenv;
    1.17 -	struct dict *dict;	
    1.18 +	struct dict *dict;
    1.19  	pool_t pool;
    1.20  
    1.21  	/* If there is already an interpreter context, return it rightaway */
    1.22 @@ -106,7 +107,12 @@
    1.23  	/* Initialize the dict */
    1.24  	dict = dict_init
    1.25  		(ext_data->dict_uri, DICT_DATA_TYPE_STRING, senv->username, PKG_RUNDIR);
    1.26 -	
    1.27 +
    1.28 +	if ( dict == NULL ) {
    1.29 +		sieve_sys_error(renv->svinst, "sieve extdata: failed to initialize dict %s",
    1.30 +			ext_data->dict_uri);
    1.31 +	}
    1.32 +
    1.33  	/* Create interpreter context */
    1.34  	pool = sieve_interpreter_pool(renv->interp);
    1.35  	ictx = p_new(pool, struct ext_extdata_interpreter_context, 1);
    1.36 @@ -140,7 +146,9 @@
    1.37  	}
    1.38  
    1.39  	if ( ictx->dict == NULL ) {
    1.40 -		sieve_runtime_trace_error(renv, "dict failed to initialize");
    1.41 +		sieve_runtime_error(renv, NULL,
    1.42 +			"failed to retrieve external data item %s due to internal error "
    1.43 +			"(refer to server log for more information).", identifier);
    1.44  		return NULL;
    1.45  	}
    1.46  
     2.1 --- a/tests/extdata-namespace.svtest	Tue Aug 17 18:40:31 2010 +0200
     2.2 +++ b/tests/extdata-namespace.svtest	Sat Sep 04 14:56:46 2010 +0200
     2.3 @@ -2,8 +2,8 @@
     2.4  require "vnd.dovecot.extdata";
     2.5  require "variables";
     2.6  
     2.7 -test_config :set "sieve_extdata_dict_uri" "file:tests/values.dict";
     2.8 -test_config :reload "vnd.dovecot.extdata";
     2.9 +test_config_set "sieve_extdata_dict_uri" "file:tests/values.dict";
    2.10 +test_config_reload :extension "vnd.dovecot.extdata";
    2.11  
    2.12  test "Name" {
    2.13  	if not string :is "${extdata.name}" "Irvin D. Iot" {
     3.1 --- a/tests/extdata-test.svtest	Tue Aug 17 18:40:31 2010 +0200
     3.2 +++ b/tests/extdata-test.svtest	Sat Sep 04 14:56:46 2010 +0200
     3.3 @@ -2,8 +2,8 @@
     3.4  require "vnd.dovecot.extdata";
     3.5  require "variables";
     3.6  
     3.7 -test_config :set "sieve_extdata_dict_uri" "file:tests/values.dict";
     3.8 -test_config :reload "vnd.dovecot.extdata";
     3.9 +test_config_set "sieve_extdata_dict_uri" "file:tests/values.dict";
    3.10 +test_config_reload :extension "vnd.dovecot.extdata";
    3.11  
    3.12  test "Name" {
    3.13  	if not extdata :is "name" "Irvin D. Iot" {