forked from cel-expr/cel-cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherror.h
More file actions
53 lines (41 loc) · 1.34 KB
/
Copy patherror.h
File metadata and controls
53 lines (41 loc) · 1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#ifndef THIRD_PARTY_CEL_CPP_COMMON_ERROR_H_
#define THIRD_PARTY_CEL_CPP_COMMON_ERROR_H_
#include "google/rpc/status.pb.h"
#include "absl/container/node_hash_set.h"
#include "absl/types/span.h"
#include "internal/hash_util.h"
#include "internal/proto_util.h"
namespace google {
namespace api {
namespace expr {
namespace common {
/** A CEL Error. */
class Error {
public:
using ErrorData = absl::node_hash_set<google::rpc::Status, internal::Hasher,
internal::DefaultProtoEqual>;
explicit Error(const google::rpc::Status& error);
explicit Error(absl::Span<const google::rpc::Status* const> errors);
explicit Error(absl::Span<const google::rpc::Status> errors);
const ErrorData& errors() const;
bool operator==(const Error& rhs) const;
inline bool operator!=(const Error& rhs) const { return !(*this == rhs); }
/** The hash code for this value. */
std::size_t hash_code() const;
/**
* A string useful for debugging.
*
* Format may change, and computation may be expensive.
*/
std::string ToDebugString() const;
private:
ErrorData errors_;
};
inline std::ostream& operator<<(std::ostream& os, const Error& value) {
return os << value.ToDebugString();
}
} // namespace common
} // namespace expr
} // namespace api
} // namespace google
#endif // THIRD_PARTY_CEL_CPP_COMMON_ERROR_H_