Browse Source

Fix up missing error strings

default_compile_flags
vector-of-bool 4 years ago
parent
commit
90fc66b58f
2 changed files with 29 additions and 22 deletions
  1. +3
    -6
      src/dds/catalog/catalog.test.cpp
  2. +26
    -16
      src/dds/error/errors.cpp

+ 3
- 6
src/dds/catalog/catalog.test.cpp View File

dds::package_id("foo", semver::version::parse("1.2.3")), dds::package_id("foo", semver::version::parse("1.2.3")),
{}, {},
"example", "example",
dds::git_remote_listing{"http://example.com", "master", std::nullopt},
{},
dds::git_remote_listing{"http://example.com", "master", std::nullopt, {}},
}); });


auto pkgs = db.by_name("foo"); auto pkgs = db.by_name("foo");
dds::package_id("foo", semver::version::parse("1.2.3")), dds::package_id("foo", semver::version::parse("1.2.3")),
{}, {},
"example", "example",
dds::git_remote_listing{"http://example.com", "develop", std::nullopt},
{},
dds::git_remote_listing{"http://example.com", "develop", std::nullopt, {}},
})); }));
// The previous pkg_id is still a valid lookup key // The previous pkg_id is still a valid lookup key
info = db.get(pkgs[0]); info = db.get(pkgs[0]);
{"baz", {semver::version::parse("5.3.0"), semver::version::parse("6.0.0")}}, {"baz", {semver::version::parse("5.3.0"), semver::version::parse("6.0.0")}},
}, },
"example", "example",
dds::git_remote_listing{"http://example.com", "master", std::nullopt},
{},
dds::git_remote_listing{"http://example.com", "master", std::nullopt, {}},
}); });
auto pkgs = db.by_name("foo"); auto pkgs = db.by_name("foo");
REQUIRE(pkgs.size() == 1); REQUIRE(pkgs.size() == 1);

+ 26
- 16
src/dds/error/errors.cpp View File

return "no-catalog-remote-info.html"; return "no-catalog-remote-info.html";
case errc::git_clone_failure: case errc::git_clone_failure:
return "git-clone-failure.html"; return "git-clone-failure.html";
case errc::invalid_repo_transform:
return "invalid-repo-transform.html";
case errc::sdist_ident_mismatch: case errc::sdist_ident_mismatch:
return "sdist-ident-mismatch.html"; return "sdist-ident-mismatch.html";
case errc::corrupted_build_db: case errc::corrupted_build_db:
return "dup-lib-name.html"; return "dup-lib-name.html";
case errc::unknown_usage_name: case errc::unknown_usage_name:
return "unknown-usage.html"; return "unknown-usage.html";
case errc::template_error:
return "template-error.html";
case errc::none: case errc::none:
break; break;
} }
dds tried to clone a repository using Git, but the clone operation failed. dds tried to clone a repository using Git, but the clone operation failed.
There are a variety of possible causes. It is best to check the output from There are a variety of possible causes. It is best to check the output from
Git in diagnosing this failure. Git in diagnosing this failure.
)";
case errc::invalid_repo_transform:
return R"(
A 'transform' property in a catalog entry contains an invalid transformation.
These cannot and should not be saved to the catalog.
)"; )";
case errc::sdist_ident_mismatch: case errc::sdist_ident_mismatch:
return R"( return R"(
available, either from the `package.json5` or from the `INDEX.lmi` that was used available, either from the `package.json5` or from the `INDEX.lmi` that was used
for the build. for the build.
)"; )";
case errc::template_error:
return R"(dds encountered a problem while rendering a file template and cannot continue.)";
case errc::none: case errc::none:
break; break;
} }
std::terminate(); std::terminate();
} }


#define BUG_STRING_SUFFIX " <- (Seeing this text is a `dds` bug. Please report it.)"

std::string_view dds::default_error_string(dds::errc ec) noexcept { std::string_view dds::default_error_string(dds::errc ec) noexcept {
switch (ec) { switch (ec) {
case errc::invalid_builtin_toolchain: case errc::invalid_builtin_toolchain:
"packages"; "packages";
case errc::git_clone_failure: case errc::git_clone_failure:
return "A git-clone operation failed."; return "A git-clone operation failed.";
case errc::invalid_repo_transform:
return "A repository filesystem transformation is invalid";
case errc::sdist_ident_mismatch: case errc::sdist_ident_mismatch:
return "The package version of a generated source distribution did not match the version\n"
"that was expected of it";
return "The package version of a generated source distribution did not match the "
"version\n that was expected of it";
case errc::corrupted_build_db: case errc::corrupted_build_db:
return "The build database file is corrupted"; return "The build database file is corrupted";
case errc::invalid_lib_manifest: case errc::invalid_lib_manifest:
case errc::invalid_pkg_manifest: case errc::invalid_pkg_manifest:
return "The package manifest is invalid"; return "The package manifest is invalid";
case errc::invalid_version_range_string: case errc::invalid_version_range_string:
return "Attempted to parse an invalid version range string. <- (Seeing this text is a "
"`dds` bug. Please report it.)";
return "Attempted to parse an invalid version range string." BUG_STRING_SUFFIX;
case errc::invalid_version_string: case errc::invalid_version_string:
return "Attempted to parse an invalid version string. <- (Seeing this text is a `dds` "
"bug. Please report it.)";
return "Attempted to parse an invalid version string." BUG_STRING_SUFFIX;
case errc::invalid_config_key: case errc::invalid_config_key:
return "Found an invalid configuration key. <- (Seeing this text is a `dds` bug. "
"Please report it.)";
return "Found an invalid configuration key." BUG_STRING_SUFFIX;
case errc::invalid_lib_filesystem: case errc::invalid_lib_filesystem:
case errc::invalid_pkg_filesystem: case errc::invalid_pkg_filesystem:
return "The filesystem structure of the package/library is invalid. <- (Seeing this "
"text is a `dds` bug. Please report it.)";
return "The filesystem structure of the package/library is invalid." BUG_STRING_SUFFIX;
case errc::invalid_pkg_id: case errc::invalid_pkg_id:
return "A package identifier is invalid <- (Seeing this text is a `dds` bug. Please "
"report it.)";
return "A package identifier is invalid." BUG_STRING_SUFFIX;
case errc::invalid_pkg_name: case errc::invalid_pkg_name:
return "A package name is invalid <- (Seeing this text is a `dds` bug. Please report "
"it.)";
return "A package name is invalid." BUG_STRING_SUFFIX;
case errc::sdist_exists: case errc::sdist_exists:
return "The source ditsribution already exists at the destination <- (Seeing this "
"text is a `dds` bug. Please report it.)";
return "The source ditsribution already exists at the destination " BUG_STRING_SUFFIX;
case errc::unknown_test_driver: case errc::unknown_test_driver:
return "The specified test_driver is not known to `dds`"; return "The specified test_driver is not known to `dds`";
case errc::dependency_resolve_failure: case errc::dependency_resolve_failure:
return "More than one library has claimed the same name."; return "More than one library has claimed the same name.";
case errc::unknown_usage_name: case errc::unknown_usage_name:
return "A `uses` or `links` field names a library that isn't recognized."; return "A `uses` or `links` field names a library that isn't recognized.";
case errc::template_error:
return "There was an error while rendering a template file." BUG_STRING_SUFFIX;
case errc::none: case errc::none:
break; break;
} }

Loading…
Cancel
Save