Skip to content

Commit

Permalink
Use printErrorInformation() over printExceptionInformation() where po…
Browse files Browse the repository at this point in the history
…ssible
  • Loading branch information
cameel committed Aug 11, 2023
1 parent 4020552 commit a59fc39
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
4 changes: 4 additions & 0 deletions liblangutil/SourceReferenceFormatter.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ class SourceReferenceFormatter
m_withErrorIds(_withErrorIds)
{}

// WARNING: Use the xyzErrorInformation() variants over xyzExceptionInformation() when you
// do have access to an Error instance. Error is implicitly convertible to util::Exception
// but the conversion loses the error ID.

/// Prints source location if it is given.
void printSourceLocation(SourceReference const& _ref);
void printExceptionInformation(SourceReferenceExtractor::Message const& _msg);
Expand Down
2 changes: 1 addition & 1 deletion solc/CommandLineInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -827,7 +827,7 @@ void CommandLineInterface::compile()
else
{
m_hasOutput = true;
formatter.printExceptionInformation(_error, Error::errorSeverity(_error.type()));
formatter.printErrorInformation(_error);
solThrow(CommandLineExecutionError, "");
}
}
Expand Down
5 changes: 1 addition & 4 deletions test/tools/ossfuzz/yulProto_diff_ossfuzz.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,7 @@ DEFINE_PROTO_FUZZER(Program const& _input)
Error::containsErrors(stack.errors())
)
{
SourceReferenceFormatter formatter(std::cout, stack, false, false);

for (auto const& error: stack.errors())
formatter.printExceptionInformation(*error, Error::errorSeverity(error->type()));
SourceReferenceFormatter{std::cout, stack, false, false}.printErrorInformation(stack.errors());
yulAssert(false, "Proto fuzzer generated malformed program");
}

Expand Down

0 comments on commit a59fc39

Please sign in to comment.