| 51 | #define ERROR_CODE_BUFFER_OUT_OF_BOUND "Buffer out of bound" |
| 52 | |
| 53 | std::string Error::to_string() const { |
| 54 | std::string result = code_as_string(); |
| 55 | if (!state_->msg_.empty()) { |
| 56 | result += ": "; |
| 57 | result += state_->msg_; |
| 58 | } |
| 59 | return result; |
| 60 | } |
| 61 | |
| 62 | std::string Error::code_as_string() const { |
| 63 | static std::unordered_map<ErrorCode, std::string> code_to_str = { |