Example #1
0
static void mrb_vedis_error(mrb_state *mrb, vedis *store, const char *msg)
{
    const char *err;
    int elen = 0;

    if (store) {
        vedis_config(store, VEDIS_CONFIG_ERR_LOG, &err, &elen);
        if (elen > 0) {
            vedis_lib_shutdown();
            mrb_raisef(mrb, E_RUNTIME_ERROR, "vedis error: %S", mrb_str_new_cstr(mrb, err));
        }
    } else {
        if (msg) {
            vedis_lib_shutdown();
            mrb_raisef(mrb, E_RUNTIME_ERROR, "vedis error: %S", mrb_str_new_cstr(mrb, msg));
        }
    }
    mrb_raise(mrb, E_RUNTIME_ERROR, "vedis unexpected error");
}
Example #2
0
/*
 * Extract the datastore error log and exit.
 */
static void Fatal(vedis *pStore,const char *zMsg)
{
	if( pStore ){
		const char *zErr;
		int iLen = 0; /* Stupid cc warning */

		/* Extract the datastore error log */
		vedis_config(pStore,VEDIS_CONFIG_ERR_LOG,&zErr,&iLen);
		if( iLen > 0 ){
			/* Output the DB error log */
			puts(zErr); /* Always null termniated */
		}
	}else{
		if( zMsg ){
			puts(zMsg);
		}
	}
	/* Manually shutdown the library */
	vedis_lib_shutdown();
	/* Exit immediately */
	exit(0);
}