adding close to rpc con, adding typedfes, fix detail error reporting

This commit is contained in:
Daniel Larimer 2013-02-04 11:13:02 -05:00
parent ad37d323f8
commit b7f1f7bdc7
6 changed files with 16 additions and 4 deletions

View file

@ -48,6 +48,7 @@ namespace fc {
error_frame& current();
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( 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 );
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_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_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()

View file

@ -139,6 +139,8 @@ namespace fc { namespace json {
void add_method( const fc::string& name, const fc::json::rpc_server_method::ptr& func );
virtual void close(){};
protected:
void handle_message( const value& m );
virtual void send_notice( const fc::string& m, value&& param ) = 0;

View file

@ -1,5 +1,4 @@
#ifndef _FC_OPTIONAL_HPP_
#define _FC_OPTIONAL_HPP_
#pragma once
#include <fc/utility.hpp>
namespace fc {
@ -94,4 +93,3 @@ namespace fc {
} // namespace fc
#endif

View file

@ -1,6 +1,7 @@
#pragma once
#include <fc/utility.hpp>
#include <fc/fwd.hpp>
#include <fc/optional.hpp>
/**
@ -98,5 +99,7 @@ namespace fc {
fc::fwd<std::string,32> my;
};
typedef fc::optional<fc::string> ostring;
} // namespace fc

View file

@ -2,6 +2,7 @@
#include <stdint.h>
#include <fc/string.hpp>
#include <fc/raw.hpp>
#include <fc/optional.hpp>
namespace fc {
class microseconds {
@ -56,4 +57,6 @@ namespace fc {
template<typename Stream, typename T>
void pack( Stream& s, const fc::time_point& v );
}
typedef fc::optional<time_point> otime_point;
}

View file

@ -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 ) );
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 )
{