#pragma once

#include <exception>

namespace Dichotomy {

// Custom exception class
class GDException : public std::exception {

    public:

        // Constructor
        GDException(std::string msg): _msg(msg) {}

        GDException() {}

        // Override what() method
        const char* what() const noexcept override {
            if(_msg != "") {
                return _msg.c_str();
            } else {
                return "An error occurred during the search: ";
            }
        }

        std::string& msg() { return _msg; }

    private:
        std::string _msg;

};

}