Skip to content
This repository has been archived by the owner on Apr 17, 2019. It is now read-only.

Introduce error codes to SFV #1817

Merged
merged 19 commits into from
Nov 8, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions irohad/ametsuchi/command_executor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ namespace shared_model {
class SetQuorum;
class SubtractAssetQuantity;
class TransferAsset;
} // namespace interface
} // namespace interface
} // namespace shared_model

namespace iroha {
Expand All @@ -38,8 +38,11 @@ namespace iroha {
* Contains command name, as well as an error message
*/
struct CommandError {
using ErrorCodeType = uint32_t;

std::string command_name;
std::string error_message;
ErrorCodeType error_code;
std::string error_extra;

std::string toString() const;
};
Expand Down
7 changes: 2 additions & 5 deletions irohad/ametsuchi/impl/mutable_storage_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,13 @@ namespace iroha {
MutableStorageImpl::MutableStorageImpl(
shared_model::interface::types::HashType top_hash,
std::unique_ptr<soci::session> sql,
std::shared_ptr<shared_model::interface::CommonObjectsFactory> factory,
std::shared_ptr<shared_model::interface::PermissionToString>
perm_converter)
std::shared_ptr<shared_model::interface::CommonObjectsFactory> factory)
: top_hash_(top_hash),
sql_(std::move(sql)),
peer_query_(std::make_unique<PeerQueryWsv>(
std::make_shared<PostgresWsvQuery>(*sql_, std::move(factory)))),
block_index_(std::make_unique<PostgresBlockIndex>(*sql_)),
command_executor_(std::make_shared<PostgresCommandExecutor>(
*sql_, std::move(perm_converter))),
command_executor_(std::make_shared<PostgresCommandExecutor>(*sql_)),
committed(false),
log_(logger::log("MutableStorage")) {
*sql_ << "BEGIN";
Expand Down
5 changes: 1 addition & 4 deletions irohad/ametsuchi/impl/mutable_storage_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#include <soci/soci.h>
#include "ametsuchi/command_executor.hpp"
#include "interfaces/common_objects/common_objects_factory.hpp"
#include "interfaces/permission_to_string.hpp"
#include "logger/logger.hpp"

namespace iroha {
Expand All @@ -28,9 +27,7 @@ namespace iroha {
shared_model::interface::types::HashType top_hash,
std::unique_ptr<soci::session> sql,
std::shared_ptr<shared_model::interface::CommonObjectsFactory>
factory,
std::shared_ptr<shared_model::interface::PermissionToString>
perm_converter);
factory);

bool apply(const shared_model::interface::Block &block) override;

Expand Down
Loading