From c3c7193dc1c276bb8d40ea63a941b20ad8f1ee9a Mon Sep 17 00:00:00 2001 From: iamAbhishekkumar Date: Mon, 7 Oct 2024 23:39:31 +0530 Subject: [PATCH] changed custom exception name --- include/gitRepo.hpp | 2 +- include/gitexceptions.hpp | 4 ++-- src/gitexceptions.cpp | 4 +--- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/include/gitRepo.hpp b/include/gitRepo.hpp index da1f7e9..d24f746 100644 --- a/include/gitRepo.hpp +++ b/include/gitRepo.hpp @@ -19,7 +19,7 @@ class GitRepo { gitdir = fs::path(worktree) / DOTGIT; if (!(force || (fs::exists(gitdir) && fs::is_directory(gitdir)))) { - throw Exception("Not a Git repository" + worktree); + throw GitException("Not a Git repository" + worktree); } } diff --git a/include/gitexceptions.hpp b/include/gitexceptions.hpp index 5fb6a96..5b8c717 100644 --- a/include/gitexceptions.hpp +++ b/include/gitexceptions.hpp @@ -4,14 +4,14 @@ #include #include -class Exception : public std::exception { +class GitException : public std::exception { private: std::string message; public: // Constructor accepts a const char* that is used to set // the exception message - Exception(const std::string& msg) : message(msg) {} + GitException(const std::string& msg) : message(msg) {} // Override the what() method to return our message const char* what() const throw(); diff --git a/src/gitexceptions.cpp b/src/gitexceptions.cpp index 0ceb30b..ccfbb14 100644 --- a/src/gitexceptions.cpp +++ b/src/gitexceptions.cpp @@ -1,6 +1,4 @@ #include <../include/gitexceptions.hpp> -Exception::Exception(const std::string& msg) : message(msg) {} - // Override the what() method to return our message -const char* Exception::what() const throw() { return message.c_str(); } +const char* GitException::what() const throw() { return message.c_str(); }