MCPcopy Create free account
hub / github.com/Snapchat/Valdi / Error

Class Error

valdi_core/src/valdi_core/cpp/Utils/Error.hpp:28–82  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

26 failure to a cancellation (NSErrorFromError carries getErrorCode() into kValdiErrorDomain) and lets
27 JS filter cancellations without string-matching the message. Distinct from ErrorCodes::Composer (1-9)
28 and kResolutionSkippedDuringTeardownErrorCode (100).
29 */
30static constexpr int32_t kPromiseCanceledErrorCode = 101;
31
32struct ErrorStorage : public SimpleRefCountable {
33 StringBox message;
34 StringBox stackTrace;
35 Ref<ErrorStorage> cause;
36 int32_t errorCode;
37
38 ErrorStorage(StringBox&& message, StringBox&& stackTrace, const Ref<ErrorStorage>& cause, int32_t errorCode = 0);
39 ~ErrorStorage() override;
40
41 bool operator==(const ErrorStorage& storage) const;
42
43 size_t hash() const;
44};
45
46class Error {
47public:
48 Error();
49 explicit Error(StringBox message);
50 explicit Error(const std::string_view& message);
51 explicit Error(const char* message);
52 Error(StringBox message, StringBox stackTrace, const Error* cause);
53 Error(StringBox message, int32_t errorCode);
54 Error(Ref<ErrorStorage> storage);
55
56 bool isEmpty() const;
57 bool hasStack() const;
58
59 std::string toString() const;
60 StringBox toStringBox() const;
61
62 /**
63 Return the outer message in the Error hierarchy.
64 */
65 const StringBox& getMessage() const noexcept;
66
67 /**
68 Return the outer stack in the Error hierarchy.
69 */
70 const StringBox& getStack() const noexcept;
71
72 std::optional<Error> getCause() const noexcept;
73
74 /**
75 Return the error code associated with this error.
76 Returns 0 if no specific error code was set.
77 */
78 int32_t getErrorCode() const noexcept;
79
80 bool operator==(const Error& other) const noexcept;
81 bool operator!=(const Error& other) const noexcept;
82
83 Error rethrow(const StringBox& message) const;
84 Error rethrow(std::string_view message) const;
85 Error rethrow(const Error& error) const;

Callers 15

consumeAndAdvanceMethod · 0.70
Error.cppFile · 0.70
getCauseMethod · 0.70
rethrowMethod · 0.70
flattenMethod · 0.70
onErrorMethod · 0.70
getErrorMethod · 0.70
makeParseErrorMethod · 0.70
doCallMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected