Created
August 12, 2016 12:53
-
-
Save ayshtmr/f65263f8645a795839794d6c890b3fd9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** @file letor_error.h | |
| * @brief Exception classes for xapian-letor. Derived from Error class in <xapian/error.h> | |
| */ | |
| /* Copyright (C) 2016 Ayush Tomar | |
| * | |
| * 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 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | |
| */ | |
| #ifndef XAPIAN_INCLUDED_LETOR_ERROR_H | |
| #define XAPIAN_INCLUDED_LETOR_ERROR_H | |
| #include <xapian.h> | |
| #include <string> | |
| #include <xapian/attributes.h> | |
| #include <xapian/visibility.h> | |
| namespace Xapian { | |
| class Error; | |
| /** FileNotFound indicates that queryfile or a qrel file to open was not found in the directory. | |
| */ | |
| class XAPIAN_VISIBILITY_DEFAULT FileNotFound : public Error { | |
| public: | |
| /** @private @internal | |
| * @brief Private constructor for use by remote backend. | |
| * | |
| * @param error_string_ Optional string describing error. May be NULL. | |
| */ | |
| FileNotFound(const std::string &msg_, const std::string &context_, const char * error_string_) | |
| : Error(msg_, context_, "\001FileNotFound", error_string_) {} | |
| /** General purpose constructor. | |
| * | |
| * @param msg_ Message giving details of the error, intended | |
| * for human consumption. | |
| * @param context_ Optional context information for this error. | |
| * @param errno_ Optional errno value associated with this error. | |
| */ | |
| explicit FileNotFound(const std::string &msg_, const std::string &context_ = std::string(), int errno_ = 0) | |
| : Error(msg_, context_, "\001FileNotFound", errno_) {} | |
| /** Construct from message and errno value. | |
| * | |
| * @param msg_ Message giving details of the error, intended | |
| * for human consumption. | |
| * @param errno_ Optional errno value associated with this error. | |
| */ | |
| FileNotFound(const std::string &msg_, int errno_) | |
| : Error(msg_, std::string(), "\001FileNotFound", errno_) {} | |
| protected: | |
| /** @private @internal | |
| * @brief Constructor for use by constructors of derived classes. | |
| */ | |
| FileNotFound(const std::string &msg_, const std::string &context_, const char * type_, const char * error_string_) | |
| : Error(msg_, context_, type_, error_string_) {} | |
| /** @private @internal | |
| * @brief Constructor for use by constructors of derived classes. | |
| */ | |
| FileNotFound(const std::string &msg_, const std::string &context_, const char * type_, int errno_) | |
| : Error(msg_, context_, type_, errno_) {} | |
| }; | |
| /** TrainingInputParseError indicates an error in format while parsing qrel or query file during training. | |
| */ | |
| class XAPIAN_VISIBILITY_DEFAULT TrainingInputParseError : public Error { | |
| public: | |
| /** @private @internal | |
| * @brief Private constructor for use by remote backend. | |
| * | |
| * @param error_string_ Optional string describing error. May be NULL. | |
| */ | |
| TrainingInputParseError(const std::string &msg_, const std::string &context_, const char * error_string_) | |
| : Error(msg_, context_, "\001TrainingInputParseError", error_string_) {} | |
| /** General purpose constructor. | |
| * | |
| * @param msg_ Message giving details of the error, intended | |
| * for human consumption. | |
| * @param context_ Optional context information for this error. | |
| * @param errno_ Optional errno value associated with this error. | |
| */ | |
| explicit TrainingInputParseError(const std::string &msg_, const std::string &context_ = std::string(), int errno_ = 0) | |
| : Error(msg_, context_, "\001TrainingInputParseError", errno_) {} | |
| /** Construct from message and errno value. | |
| * | |
| * @param msg_ Message giving details of the error, intended | |
| * for human consumption. | |
| * @param errno_ Optional errno value associated with this error. | |
| */ | |
| TrainingInputParseError(const std::string &msg_, int errno_) | |
| : Error(msg_, std::string(), "\001TrainingInputParseError", errno_) {} | |
| protected: | |
| /** @private @internal | |
| * @brief Constructor for use by constructors of derived classes. | |
| */ | |
| TrainingInputParseError(const std::string &msg_, const std::string &context_, const char * type_, const char * error_string_) | |
| : Error(msg_, context_, type_, error_string_) {} | |
| /** @private @internal | |
| * @brief Constructor for use by constructors of derived classes. | |
| */ | |
| TrainingInputParseError(const std::string &msg_, const std::string &context_, const char * type_, int errno_) | |
| : Error(msg_, context_, type_, errno_) {} | |
| }; | |
| } | |
| #endif /* XAPIAN_INCLUDED_LETOR_ERROR_H */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment