int maxrecs;
int startrecs;
int diagnostic;
+ char *message;
int preferred;
struct suggestions *suggestions;
enum client_state state;
cl->pquery = 0;
cl->cqlquery = 0;
cl->addinfo = 0;
+ cl->message = 0;
cl->database = 0;
cl->connection = 0;
cl->session = 0;
c->cqlquery = 0;
xfree(c->addinfo);
c->addinfo = 0;
+ xfree(c->message);
+ c->message = 0;
xfree(c->id);
xfree(c->sort_strategy);
xfree(c->sort_criteria);
WRBUF w = wrbuf_alloc();
wrbuf_printf(w, "Malformed cclmap. name=%s", s->name);
yaz_log(YLOG_WARN, "%s: %s", client_get_id(cl), wrbuf_cstr(w));
- client_set_diagnostic(cl, ZOOM_ERROR_CCL_CONFIG, wrbuf_cstr(w));
+ client_set_diagnostic(cl, ZOOM_ERROR_CCL_CONFIG,
+ ZOOM_diag_str(ZOOM_ERROR_CCL_CONFIG),
+ wrbuf_cstr(w));
client_set_state_nb(cl, Client_Error);
ccl_qual_rm(&res);
wrbuf_destroy(w);
wrbuf_printf(w, "Malformed cclmap. name=%s: value=%s (%s)",
s->name, p, addinfo);
yaz_log(YLOG_WARN, "%s: %s", client_get_id(cl), wrbuf_cstr(w));
- client_set_diagnostic(cl, ZOOM_ERROR_CCL_CONFIG, wrbuf_cstr(w));
+ client_set_diagnostic(cl, ZOOM_ERROR_CCL_CONFIG,
+ ZOOM_diag_str(ZOOM_ERROR_CCL_CONFIG),
+ wrbuf_cstr(w));
client_set_state_nb(cl, Client_Error);
ccl_qual_rm(&res);
wrbuf_destroy(w);
}
void client_set_diagnostic(struct client *cl, int diagnostic,
- const char *addinfo)
+ const char *message, const char *addinfo)
{
cl->diagnostic = diagnostic;
+ xfree(cl->message);
+ cl->message = xstrdup(message);
xfree(cl->addinfo);
cl->addinfo = 0;
if (addinfo)
cl->addinfo = xstrdup(addinfo);
}
-int client_get_diagnostic(struct client *cl, const char **addinfo)
+int client_get_diagnostic(struct client *cl, const char **message,
+ const char **addinfo)
{
+ if (message)
+ *message = cl->message;
if (addinfo)
*addinfo = cl->addinfo;
return cl->diagnostic;
Odr_int client_get_approximation(struct client *cl);
int client_get_num_records(struct client *cl);
int client_get_num_records_filtered(struct client *cl);
-int client_get_diagnostic(struct client *cl, const char **addinfo);
+int client_get_diagnostic(struct client *cl,
+ const char **message, const char **addinfo);
void client_set_diagnostic(struct client *cl, int diagnostic,
- const char *addinfo);
+ const char *message, const char *addinfo);
void client_set_database(struct client *cl, struct session_database *db);
const char *client_get_id(struct client *cl);
int client_get_maxrecs(struct client *cl);
{
yaz_log(YLOG_LOG, "Error %s from %s",
error, client_get_id(cl));
- client_set_diagnostic(cl, err, addinfo);
+ client_set_diagnostic(cl, err, error, addinfo);
client_set_state(cl, Client_Error);
}
else
{
yaz_log(YLOG_LOG, "Error %s from %s",
error, client_get_id(co->client));
- client_set_diagnostic(co->client, err, addinfo);
+ client_set_diagnostic(co->client, err, error, addinfo);
client_set_state_nb(co->client, Client_Error);
}
}
wrbuf_printf(c->wrbuf, "<diagnostic>%d</diagnostic>\n", ht[i].diagnostic);
if (ht[i].diagnostic)
{
+ wrbuf_puts(c->wrbuf, "<message>");
+ wrbuf_xmlputs(c->wrbuf, ht[i].message);
+ wrbuf_puts(c->wrbuf, "</message>\n");
wrbuf_puts(c->wrbuf, "<addinfo>");
if (ht[i].addinfo)
wrbuf_xmlputs(c->wrbuf, ht[i].addinfo);
res[*count].records = client_get_num_records(cl);
res[*count].filtered = client_get_num_records_filtered(cl);
res[*count].diagnostic =
- client_get_diagnostic(cl, &res[*count].addinfo);
+ client_get_diagnostic(cl, &res[*count].message,
+ &res[*count].addinfo);
res[*count].state = client_get_state_str(cl);
res[*count].connected = client_get_connection(cl) ? 1 : 0;
session_settings_dump(se, client_get_database(cl), w);
Odr_int hits;
Odr_int approximation;
int diagnostic;
+ const char *message;
const char *addinfo;
int records;
int filtered;
<name>Target name</name>
<hits>0</hits>
<diagnostic>114</diagnostic>
+<message>Unsupported Use attribute</message>
<addinfo>host_wildcard</addinfo>
<records>0</records>
<state>Client_Error</state>