Introduce formatExceptionInformation

This commit is contained in:
Alex Beregszaszi 2017-03-29 22:40:10 +01:00
parent fefb3fad6f
commit b1db6eac8b
2 changed files with 12 additions and 3 deletions

View File

@ -23,6 +23,7 @@
#pragma once
#include <ostream>
#include <sstream>
#include <functional>
#include <libevmasm/SourceLocation.h>
@ -53,6 +54,16 @@ public:
std::string const& _name,
ScannerFromSourceNameFun const& _scannerFromSourceName
);
static std::string formatExceptionInformation(
Exception const& _exception,
std::string const& _name,
ScannerFromSourceNameFun const& _scannerFromSourceName
)
{
std::ostringstream errorOutput;
printExceptionInformation(errorOutput, _exception, _name, _scannerFromSourceName);
return errorOutput.str();
}
private:
/// Prints source name if location is given.
static void printSourceName(

View File

@ -56,9 +56,7 @@ string formatError(
function<Scanner const&(string const&)> const& _scannerFromSourceName
)
{
ostringstream errorOutput;
SourceReferenceFormatter::printExceptionInformation(errorOutput, _exception, _name, _scannerFromSourceName);
return errorOutput.str();
return SourceReferenceFormatter::formatExceptionInformation(_exception, _name, _scannerFromSourceName);
}
Json::Value functionHashes(ContractDefinition const& _contract)