Merge pull request #13162 from ethereum/cleanup_helpers_around_errors

cleaning up helpers around errors
This commit is contained in:
Nishant Sachdeva
2022-09-20 20:49:45 +05:30
committed by GitHub
19 changed files with 276 additions and 229 deletions
@@ -0,0 +1,2 @@
// SPDX-License-Identifier: GPL-3.0
pragma solidity *;
@@ -0,0 +1,13 @@
{
"language": "Solidity",
"sources": {
"url_not_found.sol": {
"urls": [
"standard_urls_existing_and_missing/non-existent-contract-1.sol",
"standard_urls_existing_and_missing/contract.sol",
"standard_urls_existing_and_missing/non-existent-contract-2.sol"
]
}
},
"settings": {"outputSelection": {"*": { "*": ["metadata", "evm.bytecode"]}}}
}
@@ -0,0 +1 @@
{"errors":[{"component":"general","formattedMessage":"Cannot import url (\"standard_urls_existing_and_missing/non-existent-contract-1.sol\"): File not found. Searched the following locations: \"\".","message":"Cannot import url (\"standard_urls_existing_and_missing/non-existent-contract-1.sol\"): File not found. Searched the following locations: \"\".","severity":"warning","type":"Warning"}],"sources":{"url_not_found.sol":{"id":0}}}
@@ -0,0 +1,2 @@
// SPDX-License-Identifier: GPL-3.0
pragma solidity *;
@@ -0,0 +1,13 @@
{
"language": "Solidity",
"sources": {
"url_not_found.sol": {
"urls": [
"standard_urls_missing/non-existent-contract-1.sol",
"standard_urls_missing/non-existent-contract.sol",
"standard_urls_missing/non-existent-contract-2.sol"
]
}
},
"settings": {"outputSelection": {"*": { "*": ["metadata", "evm.bytecode"]}}}
}
@@ -0,0 +1 @@
{"errors":[{"component":"general","formattedMessage":"Cannot import url (\"standard_urls_missing/non-existent-contract-1.sol\"): File not found. Searched the following locations: \"\".","message":"Cannot import url (\"standard_urls_missing/non-existent-contract-1.sol\"): File not found. Searched the following locations: \"\".","severity":"error","type":"IOError"},{"component":"general","formattedMessage":"Cannot import url (\"standard_urls_missing/non-existent-contract.sol\"): File not found. Searched the following locations: \"\".","message":"Cannot import url (\"standard_urls_missing/non-existent-contract.sol\"): File not found. Searched the following locations: \"\".","severity":"error","type":"IOError"},{"component":"general","formattedMessage":"Cannot import url (\"standard_urls_missing/non-existent-contract-2.sol\"): File not found. Searched the following locations: \"\".","message":"Cannot import url (\"standard_urls_missing/non-existent-contract-2.sol\"): File not found. Searched the following locations: \"\".","severity":"error","type":"IOError"}],"sources":{}}
+1 -1
View File
@@ -71,7 +71,7 @@ string solidity::frontend::test::searchErrors(ErrorList const& _errors, vector<p
break;
}
if (!found)
return "Unexpected error: " + error->typeName() + ": " + msg;
return "Unexpected error: " + Error::formatErrorType(error->type()) + ": " + msg;
}
if (!expectations.empty())
{
+1 -1
View File
@@ -145,7 +145,7 @@ void SyntaxTest::filterObtainedErrors()
}
}
m_errorList.emplace_back(SyntaxTestError{
currentError->typeName(),
Error::formatErrorType(currentError->type()),
currentError->errorId(),
errorMessage(*currentError),
sourceName,
+1 -1
View File
@@ -61,7 +61,7 @@ void SyntaxTest::parseAndAnalyze()
}
m_errorList.emplace_back(SyntaxTestError{
error->typeName(),
Error::formatErrorType(error->type()),
error->errorId(),
errorMessage(*error),
name,
+1 -4
View File
@@ -79,10 +79,7 @@ DEFINE_PROTO_FUZZER(Program const& _input)
SourceReferenceFormatter formatter(std::cout, stack, false, false);
for (auto const& error: stack.errors())
formatter.printExceptionInformation(
*error,
(error->type() == Error::Type::Warning) ? "Warning" : "Error"
);
formatter.printExceptionInformation(*error, Error::errorSeverity(error->type()));
yulAssert(false, "Proto fuzzer generated malformed program");
}