forked from dashpay/dash
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathexceptions.cpp
More file actions
39 lines (35 loc) · 1.26 KB
/
exceptions.cpp
File metadata and controls
39 lines (35 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// Copyright (c) 2023-2025 The Dash Core developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <governance/exceptions.h>
#include <tinyformat.h>
#include <iostream>
std::ostream& operator<<(std::ostream& os, governance_exception_type_enum_t eType)
{
switch (eType) {
case GOVERNANCE_EXCEPTION_NONE:
os << "GOVERNANCE_EXCEPTION_NONE";
break;
case GOVERNANCE_EXCEPTION_WARNING:
os << "GOVERNANCE_EXCEPTION_WARNING";
break;
case GOVERNANCE_EXCEPTION_PERMANENT_ERROR:
os << "GOVERNANCE_EXCEPTION_PERMANENT_ERROR";
break;
case GOVERNANCE_EXCEPTION_TEMPORARY_ERROR:
os << "GOVERNANCE_EXCEPTION_TEMPORARY_ERROR";
break;
case GOVERNANCE_EXCEPTION_INTERNAL_ERROR:
os << "GOVERNANCE_EXCEPTION_INTERNAL_ERROR";
break;
}
return os;
}
CGovernanceException::CGovernanceException(const std::string& strMessageIn,
governance_exception_type_enum_t eTypeIn,
int nNodePenaltyIn) :
strMessage{strprintf("%s:%s", eTypeIn, strMessageIn)},
eType{eTypeIn},
nNodePenalty{nNodePenaltyIn}
{
}