MCPcopy Create free account
hub / github.com/OpenAssetIO/OpenAssetIO / errorCodeToMessage

Function errorCodeToMessage

src/openassetio-core/src/utils/Regex.cpp:25–35  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

23constexpr Str::size_type kErrorMessageMaxLength = 1000;
24
25Str errorCodeToMessage(const int errorCode) {
26 Str errorMessage(kErrorMessageMaxLength, '\0');
27
28 static_assert(sizeof(Str::value_type) == sizeof(PCRE2_UCHAR8), "PCRE2 char type size mismatch");
29
30 const auto errorMessageLength = pcre2_get_error_message(
31 // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
32 errorCode, reinterpret_cast<PCRE2_UCHAR8*>(errorMessage.data()), errorMessage.size());
33 errorMessage.resize(static_cast<Str::size_type>(errorMessageLength));
34 return errorMessage;
35}
36} // namespace
37
38Regex::Regex(const std::string_view pattern) {

Callers 3

RegexMethod · 0.85
matchMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected