Improve json exception handling

This commit is contained in:
seelabs
2018-05-24 21:20:30 -04:00
parent f31ca2860f
commit 00df097e5f
4 changed files with 100 additions and 49 deletions

View File

@@ -20,8 +20,10 @@
#ifndef RIPPLE_JSON_JSON_ASSERT_H_INCLUDED
#define RIPPLE_JSON_JSON_ASSERT_H_INCLUDED
#include "ripple/json/json_errors.h"
#define JSON_ASSERT_UNREACHABLE assert( false )
#define JSON_ASSERT( condition ) assert( condition ); // @todo <= change this into an exception throw
#define JSON_ASSERT_MESSAGE( condition, message ) if (!( condition )) ripple::Throw<std::runtime_error> ( message );
#define JSON_ASSERT_MESSAGE( condition, message ) if (!( condition )) ripple::Throw<Json::error> ( message );
#endif