quickstep-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jianqiao <...@git.apache.org>
Subject [GitHub] incubator-quickstep pull request #340: More informative error for BlockNotFo...
Date Tue, 17 Apr 2018 20:21:53 GMT
Github user jianqiao commented on a diff in the pull request:

    https://github.com/apache/incubator-quickstep/pull/340#discussion_r182211596
  
    --- Diff: storage/StorageErrors.hpp ---
    @@ -61,9 +61,16 @@ class BlockMemoryTooSmall : public std::exception {
      **/
     class BlockNotFoundInMemory : public std::exception {
      public:
    +  BlockNotFoundInMemory(int block_id) : block_id_(block_id) {}
    +
       virtual const char* what() const throw() {
    -    return "BlockNotFoundInMemory: The specified block was not found in memory";
    +    std::string message = "BlockNotFoundInMemory: The specified block with ID "
    +      + std::to_string(block_id_ )+ " was not found in memory";
    +    return message.c_str();
    --- End diff --
    
    The `message` object will be destructed at the end of this method -- so the returned pointer
is likely to be invalid.
    
    As a fix we can have the `message` string stored as a member variable.


---

Mime
View raw message