spicec: warn when throwing exception

This helps to identify the code location of exception
This commit is contained in:
Marc-André Lureau 2013-09-23 22:01:53 +02:00
parent 788418db65
commit 0ca7704a5a

View File

@ -19,6 +19,7 @@
#define _H_UTILS
#include "common.h"
#include "common/log.h"
#include <spice/error_codes.h>
#include <spice/macros.h>
@ -38,12 +39,14 @@ private:
#define THROW(format, ...) { \
std::string exption_string; \
string_printf(exption_string, format, ## __VA_ARGS__ ); \
spice_warning(format, ## __VA_ARGS__ ); \
throw Exception(exption_string); \
}
#define THROW_ERR(err, format, ...) { \
std::string exption_string; \
string_printf(exption_string, format, ## __VA_ARGS__ ); \
spice_warning(format, ## __VA_ARGS__ ); \
throw Exception(exption_string, err); \
}