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 raiseDQMError(const char *context, const char *fmt, ...) {
11  va_list args;
12  char *message = nullptr;
13 
14  va_start(args, fmt);
15  vasprintf(&message, fmt, args);
16  va_end(args);
17 
18 #if WITHOUT_CMS_FRAMEWORK
19  char *final = nullptr;
20  asprintf(&final, "%s: %s", context, message ? message : FAILED);
21  std::runtime_error err(final ? final : FAILED);
22  free(final);
23 #else
24  cms::Exception err(context);
25  if (message)
26  err << message;
27 #endif
28 
29  free(message);
30  throw err;
31 }
void raiseDQMError(const char *context, const char *fmt,...)
Definition: DQMError.cc:10