/******************************************************************************* * Copyright (c) 2015-2016 ONERA. * Ce logiciel est la propriété de l’ONERA (the French Aerospace Lab). * Tous droits réservés. * * Ce programme et les éléments qui l'accompagnent sont mis à disposition * aux conditions définies par le contrat de licence logiciel CeCILL-C soumise * au droit français et respectant les principes de diffusion des logiciels libres. * Vous pouvez utiliser, modifier et/ou redistribuer ce programme * sous les conditions de la licence CeCILL-C (http://www.cecill.info). * This software is property of ONERA (the French Aerospace Lab). * All rights reserved. * * This program and the accompanying materials are made available under * the terms of the CeCILL-C license under French law and * abiding by the rules of distribution of free software. * You can use, modify and/ or redistribute the software under the terms of * the CeCILL-C license (http://www.cecill.info). * * Contributeurs/contributors: * Guillaume Infantes (ONERA - Centre de Toulouse) - initial API and implementation * *******************************************************************************/ // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // // Copyright Florent Teichteil-Koenigsbuch (2008) #include "Exception.hh" using namespace epoch; // Class Exception Exception::Exception(std::string const & error_message, std::string const & throwing_function) : error_message_(error_message) { if (!throwing_function.empty()) function_backtrace_ = std::string(" from '") + throwing_function + "':\n"; } Exception::~Exception() throw() { } const char * Exception::what() const throw() { what_message_ = std::string("HMDP exception:\n") + function_backtrace_ + " " + error_message_; return what_message_.c_str(); } void Exception::push_function_backtrace(std::string const & throwing_function) { function_backtrace_.insert(0, std::string(" from '") + throwing_function + "':\n"); } void Exception::clear_function_backtrace() { function_backtrace_.clear(); } // Class ParserException ParserException::ParserException(std::string const & error_message, std::string const & throwing_function) : Exception("HMDP parser exception: ", throwing_function) { error_message_ += error_message; } ParserException::~ParserException() throw() { } // Class RequirementException RequirementException::RequirementException(std::string const & error_message, std::string const & throwing_function) : ParserException("HMDP requirement exception: ", throwing_function) { error_message_ += error_message; } RequirementException::~RequirementException() throw() { } // Class OverflowException OverflowException::OverflowException(std::string const & error_message, std::string const & throwing_function) : Exception("HMDP overflow exception: ", throwing_function) { error_message_ += error_message; } OverflowException::~OverflowException() throw() { } // Class NumericException NumericException::NumericException(std::string const & error_message, std::string const & throwing_function) : Exception("HMDP numeric exception: ", throwing_function) { error_message_ += error_message; } NumericException::~NumericException() throw() { } // Class RedundancyException RedundancyException::RedundancyException(std::string const & error_message, std::string const & throwing_function) : Exception("HMDP redundancy exception: ", throwing_function) { error_message_ += error_message; } RedundancyException::~RedundancyException() throw() { } // Class CloneException CloneException::CloneException(std::string const & error_message, std::string const & throwing_function) : Exception("HMDP clone exception: ", throwing_function) { error_message_ += error_message; } CloneException::~CloneException() throw() { } // Class LearnerException LearnerException::LearnerException(std::string const & error_message, std::string const & throwing_function) : Exception("HMDP learner exception: ", throwing_function) { error_message_ += error_message; } LearnerException::~LearnerException() throw() { } // Class UndecidableException UndecidableException::UndecidableException(std::string const & error_message, std::string const & throwing_function) : LearnerException("HMDP learner exception (undecidable inference): ", throwing_function) { error_message_ += error_message; } UndecidableException::~UndecidableException() throw() { } // Class PlannerException PlannerException::PlannerException(std::string const & error_message, std::string const & throwing_function) : Exception("HMDP planner exception: ", throwing_function) { error_message_ += error_message; } PlannerException::~PlannerException() throw() { } // Class TimeOutException TimeOutException::TimeOutException(std::string const & error_message, std::string const & throwing_function) : PlannerException("HMDP timeout exception: ", throwing_function) { error_message_ += error_message; } TimeOutException::~TimeOutException() throw() { } // Class IncompatibilityException IncompatibilityException::IncompatibilityException(std::string const & error_message, std::string const & throwing_function) : Exception("HMDP incompatibility exception: ", throwing_function) { error_message_ += error_message; } IncompatibilityException::~IncompatibilityException() throw() { }