szaszm commented on a change in pull request #707: MINIFICPP-1117 - 
minifi::Exception is now nothrow copyable
URL: https://github.com/apache/nifi-minifi-cpp/pull/707#discussion_r364854644
 
 

 ##########
 File path: libminifi/include/Exception.h
 ##########
 @@ -44,49 +43,56 @@ enum ExceptionType {
   MAX_EXCEPTION
 };
 
-// Exception String 
 static const char *ExceptionStr[MAX_EXCEPTION] = { "File Operation", "Flow 
File Operation", "Processor Operation", "Process Session Operation", "Process 
Schedule Operation", "Site2Site Protocol",
     "General Operation", "Regex Operation" };
 
-// Exception Type to String 
 inline const char *ExceptionTypeToString(ExceptionType type) {
   if (type < MAX_EXCEPTION)
     return ExceptionStr[type];
   else
     return NULL;
 }
 
-// Exception Class
-class Exception : public std::exception {
- public:
-  // Constructor
-  /*!
-   * Create a new exception
-   */
-  Exception(ExceptionType type, std::string errorMsg)
-      : _type(type),
-        _errorMsg(std::move(errorMsg)) {
-  }
+namespace detail {
+inline size_t StringLength(const char* str) { return strlen(str); }
 
-  // Destructor
-  virtual ~Exception() noexcept {
-  }
-  virtual const char * what() const noexcept {
+template<size_t L>
+constexpr size_t StringLength(const char (&str)[L]) { return L; }
 
 Review comment:
   bug here: L is the size of the array, not the string inside. I'll change it 
to `max(L-1, 0)` and leave the case of early null termination unhandled if the 
functionality is not already present in StringUtils.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to