aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Beregszaszi <alex@rtfs.hu>2017-03-30 05:40:10 +0800
committerAlex Beregszaszi <alex@rtfs.hu>2017-04-10 21:07:36 +0800
commitb1db6eac8b298967b73e3f09c75f12f566b3074c (patch)
tree3b2659cec44947d79c60f903c43ab84e27c92734
parentfefb3fad6fa20b9c99dd987a7869c297b279032e (diff)
downloaddexon-solidity-b1db6eac8b298967b73e3f09c75f12f566b3074c.tar.gz
dexon-solidity-b1db6eac8b298967b73e3f09c75f12f566b3074c.tar.zst
dexon-solidity-b1db6eac8b298967b73e3f09c75f12f566b3074c.zip
Introduce formatExceptionInformation
-rw-r--r--libsolidity/interface/SourceReferenceFormatter.h11
-rw-r--r--solc/jsonCompiler.cpp4
2 files changed, 12 insertions, 3 deletions
diff --git a/libsolidity/interface/SourceReferenceFormatter.h b/libsolidity/interface/SourceReferenceFormatter.h
index 7034f4ab..e8676d60 100644
--- a/libsolidity/interface/SourceReferenceFormatter.h
+++ b/libsolidity/interface/SourceReferenceFormatter.h
@@ -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(
diff --git a/solc/jsonCompiler.cpp b/solc/jsonCompiler.cpp
index 45322117..f55d0c8d 100644
--- a/solc/jsonCompiler.cpp
+++ b/solc/jsonCompiler.cpp
@@ -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)