From 9514626f02d21edef33fa6212aa47fdb3c115fe9 Mon Sep 17 00:00:00 2001 From: crupest Date: Sat, 16 Dec 2023 21:16:46 +0800 Subject: Optimize exception constructor. --- include/cru/common/Exception.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'include/cru') diff --git a/include/cru/common/Exception.h b/include/cru/common/Exception.h index 06a10030..0aee871c 100644 --- a/include/cru/common/Exception.h +++ b/include/cru/common/Exception.h @@ -9,8 +9,7 @@ namespace cru { #endif class CRU_BASE_API Exception : public std::exception { public: - Exception(); - explicit Exception(String message); + explicit Exception(String message = {}); CRU_DEFAULT_COPY(Exception) CRU_DEFAULT_MOVE(Exception) @@ -40,9 +39,11 @@ class CRU_BASE_API TextEncodeException : public Exception { class ErrnoException : public Exception { public: - ErrnoException() : ErrnoException(String{}) {} - explicit ErrnoException(const String& message); - ErrnoException(const String& message, int errno_code); + /** + * @brief will retrieve errno automatically. + */ + explicit ErrnoException(String message = {}); + ErrnoException(String message, int errno_code); CRU_DELETE_COPY(ErrnoException) CRU_DELETE_MOVE(ErrnoException) -- cgit v1.2.3