std::string XarParserError::getErrorMessage()

in xar/XarParser.cpp [179:206]


std::string XarParserError::getErrorMessage() const noexcept {
  const auto getBaseMessage = [](const auto& t) {
    switch (t) {
      case XarParserErrorType::DUPLICATE_PARAMETER:
        return "Variable is assigned more than once: ";
      case XarParserErrorType::FILE_OPEN:
        return "Failed to open file for reading: ";
      case XarParserErrorType::FILE_READ:
        return "Failed to read file: ";
      case XarParserErrorType::INCORRECT_MAGIC:
        return "Incorrect squashfs magic";
      case XarParserErrorType::INVALID_OFFSET:
        return "Invalid offset: ";
      case XarParserErrorType::INVALID_SHEBANG:
        return "Invalid shebang: ";
      case XarParserErrorType::MALFORMED_LINE:
        return "Failed to parse line: ";
      case XarParserErrorType::MISSING_PARAMETERS:
        return "Missing required parameters: ";
      case XarParserErrorType::TRAMPOLINE_ERROR:
        return "Error parsing trampoline names: ";
      case XarParserErrorType::UNEXPECTED_END_OF_FILE:
        return "Unexpected end of file reached: ";
    }
    return "Unknown XarParserErrorType";
  };
  return getBaseMessage(type_) + detail_;
}