This repository was archived by the owner on Oct 28, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +20
-4
lines changed
Expand file tree Collapse file tree 4 files changed +20
-4
lines changed Original file line number Diff line number Diff line change @@ -687,9 +687,10 @@ int main(int argc, char** argv)
687687 }
688688 catch (...)
689689 {
690- cerr << " provided configuration is not well formatted\n " ;
691- cerr << " sample: \n " << genesisInfo (eth::Network::MainNetworkTest) << " \n " ;
692- return AlethErrors::Success;
690+ cerr << " provided configuration is not well-formatted\n " ;
691+ cerr << " well-formatted sample: \n "
692+ << genesisInfo (eth::Network::MainNetworkTest) << " \n " ;
693+ return AlethErrors::ConfigFileInvalid;
693694 }
694695 }
695696
Original file line number Diff line number Diff line change @@ -70,6 +70,7 @@ DEV_SIMPLE_EXCEPTION(FailedInvariant);
7070DEV_SIMPLE_EXCEPTION (ValueTooLarge);
7171DEV_SIMPLE_EXCEPTION (UnknownField);
7272DEV_SIMPLE_EXCEPTION (MissingField);
73+ DEV_SIMPLE_EXCEPTION (SyntaxError);
7374DEV_SIMPLE_EXCEPTION (WrongFieldType);
7475DEV_SIMPLE_EXCEPTION (InterfaceNotSupported);
7576DEV_SIMPLE_EXCEPTION (ExternalFunctionFailure);
Original file line number Diff line number Diff line change @@ -226,6 +226,7 @@ enum AlethErrors
226226 UnknownArgument,
227227 UnknownMiningOption,
228228 ConfigFileEmptyOrNotFound,
229+ ConfigFileInvalid,
229230 UnknownNetworkType,
230231 BadNetworkIdOption,
231232 BadConfigOption,
Original file line number Diff line number Diff line change @@ -59,7 +59,20 @@ ChainParams ChainParams::loadConfig(
5959{
6060 ChainParams cp (*this );
6161 js::mValue val;
62- js::read_string_or_throw (_json, val);
62+
63+ try
64+ {
65+ js::read_string_or_throw (_json, val);
66+ }
67+ catch (js::Error_position const & error)
68+ {
69+ std::string const comment = " json parsing error detected on line " +
70+ std::to_string (error.line_ ) + " in column " +
71+ std::to_string (error.column_ ) + " : " + error.reason_ ;
72+ std::cerr << comment << " \n " ;
73+ BOOST_THROW_EXCEPTION (SyntaxError () << errinfo_comment (comment));
74+ }
75+
6376 js::mObject obj = val.get_obj ();
6477
6578 validateConfigJson (obj);
You can’t perform that action at this time.
0 commit comments