forked from ShuriZma/suyu
1
0
Fork 0

Merge pull request #6744 from lioncash/exc

exception: Make constructors explicit
This commit is contained in:
Rodrigo Locatti 2021-07-27 16:11:17 -03:00 committed by GitHub
commit 5da97c57cd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 6 deletions

View File

@ -4,7 +4,7 @@
#pragma once
#include <stdexcept>
#include <exception>
#include <string>
#include <string_view>
#include <utility>
@ -17,7 +17,7 @@ class Exception : public std::exception {
public:
explicit Exception(std::string message) noexcept : err_message{std::move(message)} {}
const char* what() const noexcept override {
[[nodiscard]] const char* what() const noexcept override {
return err_message.c_str();
}
@ -36,21 +36,21 @@ private:
class LogicError : public Exception {
public:
template <typename... Args>
LogicError(const char* message, Args&&... args)
explicit LogicError(const char* message, Args&&... args)
: Exception{fmt::format(fmt::runtime(message), std::forward<Args>(args)...)} {}
};
class RuntimeError : public Exception {
public:
template <typename... Args>
RuntimeError(const char* message, Args&&... args)
explicit RuntimeError(const char* message, Args&&... args)
: Exception{fmt::format(fmt::runtime(message), std::forward<Args>(args)...)} {}
};
class NotImplementedException : public Exception {
public:
template <typename... Args>
NotImplementedException(const char* message, Args&&... args)
explicit NotImplementedException(const char* message, Args&&... args)
: Exception{fmt::format(fmt::runtime(message), std::forward<Args>(args)...)} {
Append(" is not implemented");
}
@ -59,7 +59,7 @@ public:
class InvalidArgument : public Exception {
public:
template <typename... Args>
InvalidArgument(const char* message, Args&&... args)
explicit InvalidArgument(const char* message, Args&&... args)
: Exception{fmt::format(fmt::runtime(message), std::forward<Args>(args)...)} {}
};