MCPcopy Create free account
hub / github.com/cel-expr/cel-cpp / FormatYamlErrorMessage

Function FormatYamlErrorMessage

env/env_yaml.cc:55–74  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

53namespace {
54
55std::string FormatYamlErrorMessage(absl::string_view yaml,
56 absl::string_view error,
57 const YAML::Mark& mark) {
58 if (mark.is_null()) {
59 return std::string(error);
60 }
61 std::string message;
62 absl::StrAppend(&message, mark.line + 1, ":", mark.column + 1, ": ", error,
63 "\n|");
64 size_t start = mark.pos - mark.column;
65 size_t end = yaml.find('\n', mark.pos);
66 if (end == std::string::npos) {
67 end = yaml.size();
68 }
69
70 absl::StrAppend(&message, yaml.substr(start, end - start), "\n|",
71 std::string(mark.column, ' '), "^");
72
73 return message;
74}
75
76absl::StatusOr<YAML::Node> LoadYaml(const std::string& yaml) {
77 try {

Callers 3

LoadYamlFunction · 0.85
YamlErrorFunction · 0.85
EnvConfigFromYamlFunction · 0.85

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected