CMS 3D CMS Logo

DQMError.cc
Go to the documentation of this file.
2 #include <cstdarg>
3 #include <cstdio>
4 #include <cstdlib>
5 
6 #if WITHOUT_CMS_FRAMEWORK
7 static const char FAILED[] = "(out of memory while formatting error message)";
8 #endif
9 
10 void
11 raiseDQMError(const char *context, const char *fmt, ...)
12 {
13  va_list args;
14  char *message = nullptr;
15 
16  va_start(args, fmt);
17  vasprintf(&message, fmt, args);
18  va_end(args);
19 
20 #if WITHOUT_CMS_FRAMEWORK
21  char *final = nullptr;
22  asprintf(&final, "%s: %s", context, message ? message : FAILED);
23  std::runtime_error err(final ? final : FAILED);
24  free(final);
25 #else
26  cms::Exception err(context);
27  if (message)
28  err << message;
29 #endif
30 
31  free(message);
32  throw err;
33 }
void raiseDQMError(const char *context, const char *fmt,...)
Definition: DQMError.cc:11