-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add DeFiErrors abstraction for error messages (#1758)
* Add DeFiErrors abstraction for error messages * Fix lint
- Loading branch information
1 parent
380dceb
commit c686a5b
Showing
3 changed files
with
43 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// Copyright (c) 2023 The DeFi Foundation | ||
// Distributed under the MIT software license, see the accompanying | ||
// file LICENSE or http://www.opensource.org/licenses/mit-license.php. | ||
|
||
#ifndef DEFI_MASTERNODES_ERRORS_H | ||
#define DEFI_MASTERNODES_ERRORS_H | ||
|
||
#include <amount.h> | ||
#include <masternodes/res.h> | ||
|
||
class DeFiErrors { | ||
public: | ||
static Res MNInvalid(const std::string &nodeRefString) { | ||
return Res::Err("node %s does not exists", nodeRefString); | ||
} | ||
|
||
static Res MNInvalidAltMsg(const std::string &nodeRefString) { | ||
return Res::Err("masternode %s does not exist", nodeRefString); | ||
} | ||
|
||
static Res MNStateNotEnabled(const std::string &nodeRefString) { | ||
return Res::Err("Masternode %s is not in 'ENABLED' state", nodeRefString); | ||
} | ||
|
||
static Res ICXBTCBelowMinSwap(const CAmount amount, const CAmount minSwap) { | ||
// TODO: Change error in later version to include amount. Retaining old msg for compatibility | ||
return Res::Err("Below minimum swapable amount, must be at least %s BTC", GetDecimaleString(minSwap)); | ||
} | ||
}; | ||
|
||
#endif // DEFI_MASTERNODES_ERRORS_H | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters