blob: c1be8b96e445019ab10edd0845f885854ae49679 [file] [log] [blame]
Luiz Capitulino9f9daf92009-11-18 23:05:30 -02001/*
2 * QError header file.
3 *
4 * Copyright (C) 2009 Red Hat Inc.
5 *
6 * Authors:
7 * Luiz Capitulino <lcapitulino@redhat.com>
8 *
9 * This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
10 * See the COPYING.LIB file in the top-level directory.
11 */
12#ifndef QERROR_H
13#define QERROR_H
14
15#include "qdict.h"
16#include <stdarg.h>
17
18typedef struct QErrorStringTable {
19 const char *desc;
20 const char *error_fmt;
21} QErrorStringTable;
22
23typedef struct QError {
24 QObject_HEAD;
25 QDict *error;
26 int linenr;
27 const char *file;
28 const char *func;
29 const QErrorStringTable *entry;
30} QError;
31
32QError *qerror_new(void);
33QError *qerror_from_info(const char *file, int linenr, const char *func,
34 const char *fmt, va_list *va);
35void qerror_print(const QError *qerror);
36QError *qobject_to_qerror(const QObject *obj);
37
38/*
39 * QError class list
40 */
Luiz Capitulino357b6152009-11-18 23:05:32 -020041#define QERR_DEVICE_NOT_FOUND \
42 "{ 'class': 'DeviceNotFound', 'data': { 'device': %s } }"
Luiz Capitulino9f9daf92009-11-18 23:05:30 -020043
Luiz Capitulino055f6122009-11-18 23:05:34 -020044#define QERR_DEVICE_NOT_ACTIVE \
45 "{ 'class': 'DeviceNotActive', 'data': { 'device': %s } }"
46
Luiz Capitulino9f9daf92009-11-18 23:05:30 -020047#endif /* QERROR_H */