adding close to rpc con, adding typedfes, fix detail error reporting
This commit is contained in:
parent
ad37d323f8
commit
b7f1f7bdc7
6 changed files with 16 additions and 4 deletions
|
|
@ -48,6 +48,7 @@ namespace fc {
|
||||||
error_frame& current();
|
error_frame& current();
|
||||||
error_report& pop_frame();
|
error_report& pop_frame();
|
||||||
error_report& push_frame( const fc::string& file, uint64_t line, const fc::string& method, const fc::string& desc, fc::value meta = fc::value() );
|
error_report& push_frame( const fc::string& file, uint64_t line, const fc::string& method, const fc::string& desc, fc::value meta = fc::value() );
|
||||||
|
error_report& push_frame( bool detail, const fc::string& file, uint64_t line, const fc::string& method, const fc::string& desc, fc::value meta = fc::value() );
|
||||||
error_report& append( const error_report& e );
|
error_report& append( const error_report& e );
|
||||||
|
|
||||||
fc::string to_string()const;
|
fc::string to_string()const;
|
||||||
|
|
@ -70,5 +71,5 @@ FC_REFLECT( fc::error_report, (stack) )
|
||||||
#define FC_THROW_REPORT( ... ) FC_THROW( fc::error_report( __FILE__, __LINE__, __func__, __VA_ARGS__ ))
|
#define FC_THROW_REPORT( ... ) FC_THROW( fc::error_report( __FILE__, __LINE__, __func__, __VA_ARGS__ ))
|
||||||
#define FC_REPORT_CURRENT(ER, ... ) (ER).pop_frame().push_frame( __FILE__, __LINE__, __func__, __VA_ARGS__ )
|
#define FC_REPORT_CURRENT(ER, ... ) (ER).pop_frame().push_frame( __FILE__, __LINE__, __func__, __VA_ARGS__ )
|
||||||
#define FC_REPORT_PUSH( ER, ... ) (ER).push_frame( __FILE__, __LINE__, __func__, __VA_ARGS__ );
|
#define FC_REPORT_PUSH( ER, ... ) (ER).push_frame( __FILE__, __LINE__, __func__, __VA_ARGS__ );
|
||||||
#define FC_REPORT_PUSH_DETAIL( ER, ... ) (ER).push_frame( true, __FILE__, __LINE__, __func__, __VA_ARGS__ );
|
#define FC_REPORT_PUSH_DETAIL( ER, ... ) (ER).push_frame( true, __FILE__, __LINE__, __func__, __VA_ARGS__ )
|
||||||
#define FC_REPORT_POP(ER) (ER).pop_frame()
|
#define FC_REPORT_POP(ER) (ER).pop_frame()
|
||||||
|
|
|
||||||
|
|
@ -139,6 +139,8 @@ namespace fc { namespace json {
|
||||||
|
|
||||||
void add_method( const fc::string& name, const fc::json::rpc_server_method::ptr& func );
|
void add_method( const fc::string& name, const fc::json::rpc_server_method::ptr& func );
|
||||||
|
|
||||||
|
virtual void close(){};
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void handle_message( const value& m );
|
void handle_message( const value& m );
|
||||||
virtual void send_notice( const fc::string& m, value&& param ) = 0;
|
virtual void send_notice( const fc::string& m, value&& param ) = 0;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
#ifndef _FC_OPTIONAL_HPP_
|
#pragma once
|
||||||
#define _FC_OPTIONAL_HPP_
|
|
||||||
#include <fc/utility.hpp>
|
#include <fc/utility.hpp>
|
||||||
|
|
||||||
namespace fc {
|
namespace fc {
|
||||||
|
|
@ -94,4 +93,3 @@ namespace fc {
|
||||||
|
|
||||||
} // namespace fc
|
} // namespace fc
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <fc/utility.hpp>
|
#include <fc/utility.hpp>
|
||||||
#include <fc/fwd.hpp>
|
#include <fc/fwd.hpp>
|
||||||
|
#include <fc/optional.hpp>
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -98,5 +99,7 @@ namespace fc {
|
||||||
fc::fwd<std::string,32> my;
|
fc::fwd<std::string,32> my;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
typedef fc::optional<fc::string> ostring;
|
||||||
|
|
||||||
} // namespace fc
|
} // namespace fc
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <fc/string.hpp>
|
#include <fc/string.hpp>
|
||||||
#include <fc/raw.hpp>
|
#include <fc/raw.hpp>
|
||||||
|
#include <fc/optional.hpp>
|
||||||
|
|
||||||
namespace fc {
|
namespace fc {
|
||||||
class microseconds {
|
class microseconds {
|
||||||
|
|
@ -56,4 +57,6 @@ namespace fc {
|
||||||
template<typename Stream, typename T>
|
template<typename Stream, typename T>
|
||||||
void pack( Stream& s, const fc::time_point& v );
|
void pack( Stream& s, const fc::time_point& v );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
typedef fc::optional<time_point> otime_point;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -68,6 +68,11 @@ fc::error_report& error_report::push_frame( const fc::string& file, uint64_t lin
|
||||||
stack.push_back( fc::error_frame( file, line, method, desc, meta ) );
|
stack.push_back( fc::error_frame( file, line, method, desc, meta ) );
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
fc::error_report& error_report::push_frame( bool detail, const fc::string& file, uint64_t line, const fc::string& method, const fc::string& desc, fc::value meta )
|
||||||
|
{
|
||||||
|
stack.push_back( fc::error_frame( detail, file, line, method, desc, meta ) );
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
fc::error_report& error_report::append( const error_report& e )
|
fc::error_report& error_report::append( const error_report& e )
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue