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

Stateful Validation Error Codes in Endpoint #1821

Merged
merged 26 commits into from
Nov 13, 2018
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
3718663
Introduced error codes to SQL
Akvinikym Oct 24, 2018
62277c0
Builds
Akvinikym Oct 24, 2018
9cff49e
4/16 commands
Akvinikym Oct 25, 2018
0374fae
13/16 done
Akvinikym Oct 26, 2018
efaeb6c
Tests are finished
Akvinikym Oct 26, 2018
65d0110
Review issues
Akvinikym Oct 29, 2018
0179a20
Introduced error codes to SFV
Akvinikym Oct 29, 2018
6a53519
Is now built
Akvinikym Oct 29, 2018
fed40b5
Error code is introduced, and tests are up
Akvinikym Oct 30, 2018
d4eb53b
Added a separated function for parsing SQL errors and making an error
Akvinikym Oct 31, 2018
9734efb
Review issues are addressed
Akvinikym Oct 31, 2018
af8a100
Added ToDos
Akvinikym Oct 31, 2018
c2264cd
Some after-POW issues
Akvinikym Nov 7, 2018
6ad3a94
Error codes has good ordering
Akvinikym Nov 7, 2018
64b1060
Merged with dev
Akvinikym Nov 7, 2018
ef391cb
More fixes
Akvinikym Nov 7, 2018
10213b7
Build fix
Akvinikym Nov 7, 2018
c4407e4
And more
Akvinikym Nov 7, 2018
47c55e7
Refactored switch-case
Akvinikym Nov 8, 2018
19b690e
Merge remote-tracking branch 'origin/feature/cmd-exec-err-codes' into…
Akvinikym Nov 8, 2018
fefa779
Merge remote-tracking branch 'origin/feature/stf-vld-err-codes' into …
Akvinikym Nov 8, 2018
68dfef1
Review issues are fixed
Akvinikym Nov 12, 2018
e74ebd7
Little issue
Akvinikym Nov 13, 2018
68f84f6
Another issue
Akvinikym Nov 13, 2018
ad80611
Merge branch 'trunk/stf-rsp-err-codes' into feature/pcs-err-cds
Akvinikym Nov 13, 2018
a42f1f1
Merge remote-tracking branch 'origin/trunk/stf-rsp-err-codes' into fe…
Akvinikym Nov 13, 2018
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
4 changes: 2 additions & 2 deletions iroha-cli/interactive/impl/interactive_status_cli.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,8 @@ namespace iroha_cli {
std::string message;
try {
message = userMessageMap.at(status);
if (not answer.error_message().empty()) {
message += " " + answer.error_message();
if (not answer.err_or_cmd_name().empty()) {
message += " error '" + answer.err_or_cmd_name() + "'";
}
} catch (const std::out_of_range &e) {
message =
Expand Down
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