Lines Matching refs:QError
2 * QError Module
15 #include "qerror.h"
43 * Use "sed -n '/^static.*qerror_table\[\]/,/^};/s/QERR_/&/gp' qerror.c | sort -c"
216 * qerror_new(): Create a new QError
220 QError *qerror_new(void)
222 QError *qerr;
230 static void GCC_FMT_ATTR(2, 3) qerror_abort(const QError *qerr,
235 fprintf(stderr, "qerror: bad call in function '%s':\n", qerr->func);
236 fprintf(stderr, "qerror: -> ");
246 static void GCC_FMT_ATTR(2, 0) qerror_set_data(QError *qerr,
278 static void qerror_set_desc(QError *qerr, const char *fmt)
295 * qerror_from_info(): Create a new QError from error information
308 QError *qerror_from_info(const char *file, int linenr, const char *func,
311 QError *qerr;
329 static void parse_error(const QError *qerror, int c)
331 qerror_abort(qerror, "expected '%c' in '%s'", c, qerror->entry->desc);
334 static const char *append_field(QString *outstr, const QError *qerror,
343 parse_error(qerror, '%');
346 parse_error(qerror, '(');
351 parse_error(qerror, ')');
356 qdict = qobject_to_qdict(qdict_get(qerror->error, "data"));
359 qerror_abort(qerror, "key '%s' not found in QDict", key);
370 qerror_abort(qerror, "invalid type '%c'", qobject_type(obj));
378 * qerror_human(): Format QError data into human-readable string.
380 * Formats according to member 'desc' of the specified QError object.
382 QString *qerror_human(const QError *qerror)
387 assert(qerror->entry != NULL);
391 for (p = qerror->entry->desc; *p != '\0';) {
398 p = append_field(qstring, qerror, p);
406 * qerror_print(): Print QError data
408 * This function will print the member 'desc' of the specified QError object,
412 void qerror_print(QError *qerror)
414 QString *qstring = qerror_human(qerror);
415 loc_push_restore(&qerror->loc);
417 loc_pop(&qerror->loc);
425 QError *qerror;
428 qerror = qerror_from_info(file, linenr, func, fmt, &va);
432 monitor_set_error(cur_mon, qerror);
434 qerror_print(qerror);
435 QDECREF(qerror);
440 * qobject_to_qerror(): Convert a QObject into a QError
442 QError *qobject_to_qerror(const QObject *obj)
448 return container_of(obj, QError, base);
452 * qerror_destroy_obj(): Free all memory allocated by a QError
456 QError *qerr;