MCPcopy Create free account
hub / github.com/argotorg/solidity / formatErrorWithException

Function formatErrorWithException

libsolidity/interface/StandardCompiler.cpp:118–154  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

116}
117
118Json formatErrorWithException(
119 CharStreamProvider const& _charStreamProvider,
120 util::Exception const& _exception,
121 Error::Type _type,
122 std::string const& _component,
123 std::string const& _message,
124 std::optional<ErrorId> _errorId = std::nullopt
125)
126{
127 std::string message;
128 // TODO: consider enabling color
129 std::string formattedMessage = SourceReferenceFormatter::formatExceptionInformation(
130 _exception,
131 _type,
132 _charStreamProvider,
133 false // colored
134 );
135
136 if (std::string const* description = _exception.comment())
137 message = ((_message.length() > 0) ? (_message + ": ") : "") + *description;
138 else
139 message = _message;
140
141 Json error = formatError(
142 _type,
143 _component,
144 message,
145 formattedMessage,
146 formatSourceLocation(boost::get_error_info<errinfo_sourceLocation>(_exception)),
147 formatSecondarySourceLocation(boost::get_error_info<errinfo_secondarySourceLocation>(_exception))
148 );
149
150 if (_errorId)
151 error["errorCode"] = std::to_string(_errorId.value().error);
152
153 return error;
154}
155
156/// Returns true iff @a _hash (hex with 0x prefix) is the Keccak256 hash of the binary data in @a _content.
157bool hashMatchesContent(std::string const& _hash, std::string const& _content)

Callers 2

compileSolidityMethod · 0.85
compileYulMethod · 0.85

Calls 7

formatErrorFunction · 0.85
formatSourceLocationFunction · 0.85
commentMethod · 0.80
to_stringFunction · 0.50
lengthMethod · 0.45
valueMethod · 0.45

Tested by

no test coverage detected