Skip to content
Snippets Groups Projects
exception-factory.cpp 1.46 KiB
Newer Older
Thomas Moulard's avatar
Thomas Moulard committed
/*
 * Copyright 2010,
 * François Bleibel,
 * Olivier Stasse,
Thomas Moulard's avatar
Thomas Moulard committed
 * CNRS/AIST
Thomas Moulard's avatar
Thomas Moulard committed
 */
#include <dynamic-graph/exception-factory.h>
#include <cstdio>

using namespace dynamicgraph;

/* --------------------------------------------------------------------- */
/* --- CLASS ----------------------------------------------------------- */
/* --------------------------------------------------------------------- */

const std::string ExceptionFactory::EXCEPTION_NAME = "Factory";

ExceptionFactory::ExceptionFactory(
    const ExceptionFactory::ErrorCodeEnum &errcode, const std::string &msg)
    : ExceptionAbstract(errcode, msg) {
Bergé's avatar
Bergé committed
  dgDEBUGF(15, "Created with message <%s>.", msg.c_str());
  dgDEBUG(1) << "Created with message <%s>." << msg << std::endl;
ExceptionFactory::ExceptionFactory(
    const ExceptionFactory::ErrorCodeEnum &errcode, const std::string &msg,
    const char *format, ...)
    : ExceptionAbstract(errcode, msg) {
Bergé's avatar
Bergé committed
  va_start(args, format);
Bergé's avatar
Bergé committed
  char buffer[SIZE];
  vsnprintf(buffer, SIZE, format, args);
Bergé's avatar
Bergé committed
  dgDEBUG(15) << "Created "
              << " with message <" << msg << "> and buffer <" << buffer << ">. "
              << std::endl;
Bergé's avatar
Bergé committed
  dgDEBUG(1) << "Throw exception " << EXCEPTION_NAME << "[#" << errcode << "]: "
             << "<" << message << ">." << std::endl;