From 87c2f59166b7ec5b3ce44b5c4a2337c07a78e533 Mon Sep 17 00:00:00 2001 From: Luiz Capitulino Date: Wed, 1 Jun 2011 12:14:48 -0500 Subject: QError: Introduce qerror_format() Will be used by new error propagation framework to convert Error objects into human-readable form. Signed-off-by: Luiz Capitulino Signed-off-by: Michael Roth Signed-off-by: Anthony Liguori --- qerror.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'qerror.c') diff --git a/qerror.c b/qerror.c index af6ed39b25..c18641f927 100644 --- a/qerror.c +++ b/qerror.c @@ -400,6 +400,21 @@ static QString *qerror_format_desc(QDict *error, return qstring; } +QString *qerror_format(const char *fmt, QDict *error) +{ + const QErrorStringTable *entry = NULL; + int i; + + for (i = 0; qerror_table[i].error_fmt; i++) { + if (strcmp(qerror_table[i].error_fmt, fmt) == 0) { + entry = &qerror_table[i]; + break; + } + } + + return qerror_format_desc(error, entry); +} + /** * qerror_human(): Format QError data into human-readable string. */ -- cgit v1.2.3